Fixed Report comments don't sort

digitalpoint

Well-known member
Affected version
2.2.7
Comments in reports are out of order (sometimes), with new ones inserting themselves into random places. Turns out, the report comments aren't being sorted when they are queried.

In XF\Pub\Controller\Report

Currently:
PHP:
$comments = $report->getRelationFinder('Comments')->with('User')->fetch();

Maybe change to this to get a consistent order?
PHP:
$comments = $report->getRelationFinder('Comments')->with('User')->order('comment_date')->fetch();

Currently I see this:
1633559432650.webp

Probably not overly noticeable because of how InnoDB adds new records to the end of the table (normally) so a "no order" will usually (but not always) will return in record insertion order. But that can't be relied on.
 
Last edited:
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.8).

Change log:
Ensure report comments are ordered consistently
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom