Fixed Slightly inefficient query in XF\Service\Report\ClosureNotifier::determineNotifiableUserIds


Well-known member
Affected version
The query which gets the list of user ids can just just a DISTINCT to avoid fetching more rows than needed, and probably can filter out user_id = 0 in the query itself.

ie something like;
return $db->fetchAllColumn("
   SELECT distinct user_id
   FROM xf_report_comment
   WHERE report_id = ?
      AND comment_date >= ?
      AND is_report = 1
     AND user_id <> 0
", [$reportId, (int)$lastOpenDate]);

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.7).

Change log:
Adjust the query for determining who should receive a report closure notification to only return distinct and non-zero user IDs
There may be a delay before changes are rolled out to the XenForo Community.