From 0c6da9845c312e978314d5fb880c0574651a1deb Mon Sep 17 00:00:00 2001 From: retoor Date: Wed, 17 Sep 2025 16:30:20 +0200 Subject: [PATCH] Update. --- src/snek/static/chat-input.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/snek/static/chat-input.js b/src/snek/static/chat-input.js index c1abd58..e2f15fe 100644 --- a/src/snek/static/chat-input.js +++ b/src/snek/static/chat-input.js @@ -217,8 +217,10 @@ class ChatInputComponent extends NjetComponent { const matches = this.matchMentionsToAuthors(mentions, authors); let updatedText = text; matches.forEach(({ mention, closestAuthor }) => { - const mentionRegex = new RegExp(`@${mention}`, 'g'); - updatedText = updatedText.replace(mentionRegex, `@${closestAuthor}`); + if(closestAuthor){ + const mentionRegex = new RegExp(`@${mention}`, 'g'); + updatedText = updatedText.replace(mentionRegex, `@${closestAuthor}`); + } }); return updatedText;