fix(emails): Use dedicated key in API response

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling
2024-10-18 15:40:48 +02:00
parent b8c76b0584
commit 4cb26cc724
3 changed files with 7 additions and 5 deletions

View File

@ -1082,11 +1082,8 @@ class RoomController extends AEnvironmentAwareController {
$this->participantService->leaveRoomAsSession($this->room, $participant);
}
$result['displayName'] = $participant->getAttendee()->getDisplayName();
if ($this->participant->hasModeratorPermissions()) {
$result['status'] = IUserStatus::OFFLINE;
$result['statusIcon'] = null;
$result['statusMessage'] = $participant->getAttendee()->getInvitedCloudId();
$result['statusClearAt'] = null;
if ($this->participant->hasModeratorPermissions() || $this->participant->getAttendee()->getId() === $participant->getAttendee()->getId()) {
$result['invitedActorId'] = $participant->getAttendee()->getInvitedCloudId();
}
} elseif ($participant->getAttendee()->getActorType() === Attendee::ACTOR_FEDERATED_USERS) {
if ($participant->getSession() instanceof Session && $participant->getSession()->getLastPing() <= $maxPingAge) {

View File

@ -173,6 +173,7 @@ namespace OCA\Talk;
*
* @psalm-type TalkParticipant = array{
* actorId: string,
* invitedActorId?: string,
* actorType: string,
* attendeeId: int,
* attendeePermissions: int,
@ -227,6 +228,7 @@ namespace OCA\Talk;
*
* @psalm-type TalkRoom = array{
* actorId: string,
* invitedActorId?: string,
* actorType: string,
* attendeeId: int,
* attendeePermissions: int,

View File

@ -336,6 +336,9 @@ class RoomFormatter {
$roomData['unreadMention'] = $lastMention !== 0 && $lastReadMessage < $lastMention;
$roomData['unreadMentionDirect'] = $lastMentionDirect !== 0 && $lastReadMessage < $lastMentionDirect;
} else {
if ($attendee->getActorType() === Attendee::ACTOR_EMAILS) {
$roomData['invitedActorId'] = $attendee->getInvitedCloudId();
}
$roomData['lastReadMessage'] = $attendee->getLastReadMessage();
}