Browse Source

Merge pull request #11776 from nextcloud/bugfix/noid/fix-undefined-array-key-replyToActorType

fix(federation): Undefined array key "replyToActorType"
pull/11778/head
Joas Schilling 2 years ago
committed by GitHub
parent
commit
b9c89924eb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      lib/Notification/FederationChatNotifier.php

8
lib/Notification/FederationChatNotifier.php

@ -48,6 +48,7 @@ class FederationChatNotifier {
* @param array{remoteServerUrl: string, sharedSecret: string, remoteToken: string, messageData: array{remoteMessageId: int, actorType: string, actorId: string, actorDisplayName: string, messageType: string, systemMessage: string, expirationDatetime: string, message: string, messageParameter: string, creationDatetime: string, metaData: string}, unreadInfo: array{unreadMessages: int, unreadMention: bool, unreadMentionDirect: bool}} $inboundNotification
*/
public function handleChatMessage(Room $room, Participant $participant, ProxyCacheMessage $message, array $inboundNotification): void {
/** @var array{silent?: bool, last_edited_time?: int, last_edited_by_type?: string, last_edited_by_id?: string, replyToActorType?: string, replyToActorId?: string} $metaData */
$metaData = json_decode($inboundNotification['messageData']['metaData'] ?? '', true, flags: JSON_THROW_ON_ERROR);
if (isset($metaData[Message::METADATA_SILENT])) {
@ -80,8 +81,13 @@ class FederationChatNotifier {
}
}
/**
* @param array{silent?: bool, last_edited_time?: int, last_edited_by_type?: string, last_edited_by_id?: string, replyToActorType?: string, replyToActorId?: string} $metaData
*/
protected function isRepliedTo(Room $room, Participant $participant, array $metaData): bool {
if ($metaData[ProxyCacheMessage::METADATA_REPLYTO_TYPE] !== Attendee::ACTOR_FEDERATED_USERS) {
if (!isset($metaData[ProxyCacheMessage::METADATA_REPLYTO_TYPE])
|| !isset($metaData[ProxyCacheMessage::METADATA_REPLYTO_ID])
|| $metaData[ProxyCacheMessage::METADATA_REPLYTO_TYPE] !== Attendee::ACTOR_FEDERATED_USERS) {
return false;
}

Loading…
Cancel
Save