summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-05-02 08:14:59 +0200
committerJoas Schilling <coding@schilljs.com>2023-05-02 17:59:32 +0200
commit0cf8800f20bc8a7b3c6368288a3d622bbf5c0d28 (patch)
treec469a5d9b81147485bb7adb3c0d99073efe17296 /lib
parent76eaaee883331b57d37c9cd4a09696c94054a8e0 (diff)
fix(guests): Keep guest attendees with display name or non-default permissions
This will allow us to render the display name of guests later on. This was the idea already since we dropped the talk_guests table in nextcloud/spreed#5146 and we don't delete the attendee anymore on leaving the room since then. However, the guest clean up when fetching the participant list was still deleting the guest attendees later on when they didn't have a session. Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/RoomController.php15
-rw-r--r--lib/Service/ParticipantService.php12
2 files changed, 24 insertions, 3 deletions
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index b5ebf1b69..d6441b623 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -829,9 +829,18 @@ class RoomController extends AEnvironmentAwareController {
$result['statusClearAt'] = null;
}
} elseif ($participant->getAttendee()->getActorType() === Attendee::ACTOR_GUESTS) {
- if ($result['lastPing'] <= $maxPingAge) {
- $cleanGuests = true;
- continue;
+ if ($participant->getAttendee()->getParticipantType() === Participant::GUEST
+ && ($participant->getAttendee()->getPermissions() === Attendee::PERMISSIONS_DEFAULT
+ || $participant->getAttendee()->getPermissions() === Attendee::PERMISSIONS_CUSTOM)) {
+ // Guests without an up-to-date session are filtered out. We
+ // only keep there attendees in the database, so that the
+ // comments show the display name. Only when they have
+ // non-default permissions we show them, so permissions can
+ // be reset or removed
+ if ($result['lastPing'] <= $maxPingAge) {
+ $cleanGuests = true;
+ continue;
+ }
}
$result['displayName'] = $participant->getAttendee()->getDisplayName();
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php
index 18bf8c698..e7b5c4d19 100644
--- a/lib/Service/ParticipantService.php
+++ b/lib/Service/ParticipantService.php
@@ -995,6 +995,18 @@ class ParticipantService {
$attendees = [];
$result = $query->executeQuery();
while ($row = $result->fetch()) {
+ if ($row['display_name'] !== '' && $row['display_name'] !== null) {
+ // Keep guests with a non-empty display name, so we can still
+ // render the guest display name on chat messages.
+ continue;
+ }
+
+ if ($row['permissions'] !== Attendee::PERMISSIONS_DEFAULT
+ || $row['participant_type'] === Participant::GUEST_MODERATOR) {
+ // Keep guests with non-default permissions in case they just reconnect
+ continue;
+ }
+
$attendeeIds[] = (int) $row['a_id'];
$attendees[] = $this->attendeeMapper->createAttendeeFromRow($row);
}