Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
util: Use the same regex as the backend for wildcard mentions.
Alex Vandiver92fa9ee78c78
diff --git a/web/src/util.ts b/web/src/util.tsindex 3a235ab6c7c..d7f47a7f17c 100644--- a/web/src/util.ts+++ b/web/src/util.ts@@ -195,11 +195,11 @@ export class CachedValue<T> {}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(/(?<![^\s"'(/<[{])(@\*{2}(all|everyone|stream)\*{2})/);if (mention === null) {return null;}- return mention[3];+ return mention[2];}export const move_array_elements_to_front = function util_move_array_elements_to_front<T>(diff --git a/web/tests/util.test.js b/web/tests/util.test.jsindex 3781002211f..357bd7d7dfc 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**",