mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-18 05:20:50 +01:00
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>
This commit is contained in:
parent
76eaaee883
commit
0cf8800f20
3 changed files with 32 additions and 3 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,10 @@ class FeatureContext implements Context, SnippetAcceptingContext {
|
|||
}
|
||||
}
|
||||
|
||||
if (!isset(self::$userToAttendeeId[$room][$type][$id])) {
|
||||
throw new \Exception('Attendee id unknown, please call userLoadsAttendeeIdsInRoom with a user that has access before');
|
||||
}
|
||||
|
||||
return self::$userToAttendeeId[$room][$type][$id];
|
||||
}
|
||||
|
||||
|
|
@ -1051,6 +1055,10 @@ class FeatureContext implements Context, SnippetAcceptingContext {
|
|||
// in chat messages is a hashed version instead.
|
||||
self::$sessionIdToUser[sha1($response['sessionId'])] = $user;
|
||||
self::$userToSessionId[$user] = $response['sessionId'];
|
||||
if (!isset(self::$userToAttendeeId[$identifier][$response['actorType']])) {
|
||||
self::$userToAttendeeId[$identifier][$response['actorType']] = [];
|
||||
}
|
||||
self::$userToAttendeeId[$identifier][$response['actorType']][$response['actorId']] = $response['attendeeId'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue