Fixed wrong usernames in conversation dropdown
authorMarcel Werk <burntime@woltlab.com>
Thu, 21 Apr 2022 16:51:38 +0000 (18:51 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 21 Apr 2022 16:51:38 +0000 (18:51 +0200)
files/lib/data/conversation/ConversationAction.class.php

index 3aa3c34fd5226c20c3cbf4e31a50eb44e9c6130b..abe40c8b5a068d34b3668fd750a3b4cfcaeac249 100644 (file)
@@ -910,11 +910,14 @@ class ConversationAction extends AbstractDatabaseObjectAction implements
             if ($conversation->userID === WCF::getUser()->userID) {
                 if ($conversation->participants > 1) {
                     $image = '<span class="icon icon48 fa-users"></span>';
+                    $usernames = \array_column($conversation->getParticipantSummary(), 'username');
                 } else {
                     $image = $conversation->getOtherParticipantProfile()->getAvatar()->getImageTag(48);
+                    $usernames = [$conversation->getOtherParticipantProfile()->username];
                 }
             } else {
                 $image = $conversation->getUserProfile()->getAvatar()->getImageTag(48);
+                $usernames = [$conversation->getUserProfile()->username];
             }
 
             $link = LinkHandler::getInstance()->getControllerLink(
@@ -925,8 +928,6 @@ class ConversationAction extends AbstractDatabaseObjectAction implements
                 ]
             );
 
-            $usernames = \array_column($conversation->getParticipantSummary(), 'username');
-
             return [
                 'content' => $conversation->getTitle(),
                 'image' => $image,