Skip to content

Commit

Permalink
feat: Initial implementation of reactions notifications in federated …
Browse files Browse the repository at this point in the history
…convos

Signed-off-by: skalidindi53 <[email protected]>
  • Loading branch information
skalidindi53 committed Aug 29, 2024
1 parent c9d84d8 commit 34e42e0
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,38 @@ public function handle(Event $event): void {
$attendee = $participant->getAttendee();
$cloudId = $this->cloudIdManager->resolveCloudId($attendee->getActorId());

if ($chatMessage->getMessageType() === ChatManager::VERB_REACTION){
$notificationLevel = $attendee->getNotificationLevel();

if ($notificationLevel === Participant::NOTIFY_ALWAYS) {

Check failure on line 105 in lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedClass

lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php:105:32: UndefinedClass: Class, interface or enum named OCA\Talk\Federation\Proxy\TalkV1\Notifier\Participant does not exist (see https://psalm.dev/019)
$reactionMessageData = [
'subject' => 'reaction',
'subjectData' => [
'userType' => $chatMessage->getActorType(),
'userId' => $chatMessage->getActorId(),
],
'message' => $chatMessage->getMessage(),
'commentId' => $event->getComment()->getId(),
'dateTime' => $event->getComment()->getCreationDateTime()->format(\DateTime::ATOM),
];

$reactionSuccess = $this->backendNotifier->sendMessageUpdate(
$cloudId->getRemote(),
$attendee->getId(),
$attendee->getAccessToken(),
$event->getRoom()->getToken(),
$reactionMessageData,

Check failure on line 122 in lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidArgument

lib/Federation/Proxy/TalkV1/Notifier/MessageSentListener.php:122:7: InvalidArgument: Argument 5 of OCA\Talk\Federation\BackendNotifier::sendMessageUpdate expects array{actorDisplayName: string, actorId: string, actorType: string, creationDatetime: string, expirationDatetime: string, message: string, messageParameter: string, messageType: string, metaData: string, remoteMessageId: int, systemMessage: string}, but array{commentId: string, dateTime: string, message: string, subject: 'reaction', subjectData: array{userId: string, userType: string}} with additional array shape fields (subject, subjectData, commentId, dateTime) was provided (see https://psalm.dev/004)
$unreadInfo,
);

if ($reactionSuccess === null) {
$this->participantService->removeAttendee($event->getRoom(), $participant, AAttendeeRemovedEvent::REASON_LEFT);
}

continue;
}
}

$lastReadMessage = $attendee->getLastReadMessage();
$lastMention = $attendee->getLastMentionMessage();
$lastMentionDirect = $attendee->getLastMentionDirect();
Expand Down

0 comments on commit 34e42e0

Please sign in to comment.