From 92fa9ee78c78a024e6c30df69bae2361f4a5e921 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 21 Mar 2024 19:11:29 +0000 Subject: [PATCH] util: Use the same regex as the backend for wildcard mentions. --- web/src/util.ts | 4 ++-- web/tests/util.test.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/src/util.ts b/web/src/util.ts index 3a235ab6c7..d7f47a7f17 100644 --- a/web/src/util.ts +++ b/web/src/util.ts @@ -195,11 +195,11 @@ export class CachedValue { } export function find_stream_wildcard_mentions(message_content: string): string | null { - const mention = message_content.match(/(^|\s)(@\*{2}(all|everyone|stream)\*{2})($|\s)/); + const mention = message_content.match(/(?( diff --git a/web/tests/util.test.js b/web/tests/util.test.js index 3781002211..357bd7d7df 100644 --- a/web/tests/util.test.js +++ b/web/tests/util.test.js @@ -168,6 +168,8 @@ run_test("wildcard_mentions_regexp", () => { const messages_with_everyone_mentions = [ "@**everyone**", + '"@**everyone**"', + "@**everyone**: Look at this!", "some text before @**everyone** some text after", "@**everyone** some text after only", "some text before only @**everyone**",