Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only calculate the room name once instead of loading all participants
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Feb 26, 2022
commit 114a9dda2fa18323162ce3bdbd9a929398726351
10 changes: 9 additions & 1 deletion lib/Activity/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ public function generateInvitationActivity(Room $room, array $participants): voi
return;
}

// We know the new participant is in the room,
// so skip loading them just to make sure they can read it.
// Must be overwritten later on for one-to-one chats.
$roomName = $room->getDisplayName($actorId);

foreach ($participants as $participant) {
if ($participant['actorType'] !== Attendee::ACTOR_USERS) {
// No user => no activity
Expand All @@ -244,7 +249,10 @@ public function generateInvitationActivity(Room $room, array $participants): voi
}

try {
$roomName = $room->getDisplayName($participant['actorId']);
if ($room->getType() === Room::TYPE_ONE_TO_ONE) {
// Overwrite the room name with the other participant
$roomName = $room->getDisplayName($participant['actorId']);
}
$event
->setObject('room', $room->getId(), $roomName)
->setSubject('invitation', [
Expand Down