From 66343a375190b0466dbc01ce773fda36c13dccb9 Mon Sep 17 00:00:00 2001 From: 7PH Date: Sun, 11 Aug 2024 00:42:24 +0200 Subject: [PATCH] Fix mention plugin crashes --- app/server/plugins/core/room/MentionPlugin.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/server/plugins/core/room/MentionPlugin.ts b/app/server/plugins/core/room/MentionPlugin.ts index 4332e713..87f67a31 100644 --- a/app/server/plugins/core/room/MentionPlugin.ts +++ b/app/server/plugins/core/room/MentionPlugin.ts @@ -13,7 +13,12 @@ export class MentionPlugin extends RoomPlugin { async run(): Promise {} // Intercept quotes in messages - public async onBeforeMessageBroadcastHook(message: Message, connection: Connection) { + public async onBeforeMessageBroadcastHook(message: Message, connection?: Connection) { + // It is currently not possible to mention an user if there's not connection the mention originates from + if (!connection) { + return message; + } + if (connection.session.user.right < Config.PREFERENCES.minRightForUserMention) { return message; }