diff options
author | Joas Schilling <coding@schilljs.com> | 2024-03-12 09:56:29 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-03-12 09:56:29 +0100 |
commit | 1f20864c6db84fa92ea9340c641d20cd93a62fb7 (patch) | |
tree | 1e544b568eff2da61f0d43cd10843de32eb5c37d /lib/Notification/FederationChatNotifier.php | |
parent | 835c1443e0eb8d7bbf21f73b27d7e3b0b9d30462 (diff) |
fix(federation): Undefined array key "replyToActorType"
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Notification/FederationChatNotifier.php')
-rw-r--r-- | lib/Notification/FederationChatNotifier.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Notification/FederationChatNotifier.php b/lib/Notification/FederationChatNotifier.php index 856cc8b4f..ef56078b1 100644 --- a/lib/Notification/FederationChatNotifier.php +++ b/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; } |