Fixed Resolved report alert not sent if report assigned and unassigned

mattrogowski

Well-known member
Affected version
2.3.2
When determining users to send a report update alert to in XF\Service\Report\ClosureNotifierService it runs this query:

SQL:
$lastOpenDate = $db->fetchOne("
    SELECT comment_date
    FROM xf_report_comment
    WHERE report_id = ?
        AND state_change = 'open'
    ORDER BY comment_date DESC
    LIMIT 1
", $reportId);

It then finds any comments where comment_date is greater than or equal to the date queried here, and is_report is 1. This should send the alert to users who commented since the report was last opened (or re-opened) as a report.

However, if you assign and un-assign the report, the un-assignment changes the status back to open. This means that when the report is resolved, the query finds no users to send it to (or at least, no users that had reported it to date), as there are no comments where is_report is 1 that are from after the report was most recently set to open.

To reproduce:
  1. Report a post
  2. Assign the report
  3. Un-assign the report
  4. Resolve the report and choose to send an alert
  5. The reporting user won't receive the alert
It probably instead needs to query to see if the report has ever been marked as resolved - if it has, find all reporting users after that (as it would have been re-opened), and if it hasn't, find all reporting users since the report was first opened.
 
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.3.4).

Change log:
Fix calculation of report closure notifiable users
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom