From: Alexander Ebert Date: Sat, 11 Jun 2022 11:40:49 +0000 (+0200) Subject: Incorrect sort order when the user was removed X-Git-Tag: 5.5.0_RC_3~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=04514d926caa0d0d8566e04f58d4ebfce206d09a;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git Incorrect sort order when the user was removed See https://www.woltlab.com/community/thread/295198-sortierung-von-konversationen-fehlerhaft-wenn-teilnehmer-entfernt-wird/ --- diff --git a/files/lib/data/conversation/ConversationAction.class.php b/files/lib/data/conversation/ConversationAction.class.php index 428c592..31fa8cc 100644 --- a/files/lib/data/conversation/ConversationAction.class.php +++ b/files/lib/data/conversation/ConversationAction.class.php @@ -901,6 +901,12 @@ class ConversationAction extends AbstractDatabaseObjectAction implements } } + // Being removed from a conversation might show a different time + // for the last message, requiring the items to be sorted again. + \usort($conversations, static function (ViewableConversation $a, ViewableConversation $b) { + return $b->lastPostTime <=> $a->lastPostTime; + }); + $totalCount = ConversationHandler::getInstance()->getUnreadConversationCount(); if ($count < 10 && $count < $totalCount) { UserStorageHandler::getInstance()->reset([WCF::getUser()->userID], 'unreadConversationCount');