topic_mentions: Fix the incorrect large @-mention notification warning.

Earlier, a 'large @-mention notification' warning that pops up
for stream wildcard mentions was shown for topic wildcard mentions
too, which is incorrect.

This commit fixes the incorrect behavior. We no longer show the
banner for @-topic mentions.

We don't need a banner for @-topic mentions, as those are much less
likely to be used without thinking about it and would rarely be spammy
for a lot of people.

Fixes #27767.
This commit is contained in:
Prakhar Pratyush
2023-11-21 11:34:19 +05:30
committed by Tim Abbott
parent 33b164f63a
commit 768be7d46d
11 changed files with 69 additions and 73 deletions

View File

@@ -204,46 +204,33 @@ run_test("wildcard_mentions_regexp", () => {
"some_email@**stream**.com",
];
const messages_without_topic_mentions = [
"some text before @topic some text after",
"@topic",
"`@topic`",
"some_email@topic.com",
"`@**topic**`",
"some_email@**topic**.com",
];
let i;
for (i = 0; i < messages_with_all_mentions.length; i += 1) {
assert.ok(util.find_wildcard_mentions(messages_with_all_mentions[i]));
assert.ok(util.find_stream_wildcard_mentions(messages_with_all_mentions[i]));
}
for (i = 0; i < messages_with_everyone_mentions.length; i += 1) {
assert.ok(util.find_wildcard_mentions(messages_with_everyone_mentions[i]));
assert.ok(util.find_stream_wildcard_mentions(messages_with_everyone_mentions[i]));
}
for (i = 0; i < messages_with_stream_mentions.length; i += 1) {
assert.ok(util.find_wildcard_mentions(messages_with_stream_mentions[i]));
assert.ok(util.find_stream_wildcard_mentions(messages_with_stream_mentions[i]));
}
for (i = 0; i < messages_with_topic_mentions.length; i += 1) {
assert.ok(util.find_wildcard_mentions(messages_with_topic_mentions[i]));
assert.ok(!util.find_stream_wildcard_mentions(messages_with_topic_mentions[i]));
}
for (i = 0; i < messages_without_all_mentions.length; i += 1) {
assert.ok(!util.find_wildcard_mentions(messages_without_everyone_mentions[i]));
assert.ok(!util.find_stream_wildcard_mentions(messages_without_everyone_mentions[i]));
}
for (i = 0; i < messages_without_everyone_mentions.length; i += 1) {
assert.ok(!util.find_wildcard_mentions(messages_without_everyone_mentions[i]));
assert.ok(!util.find_stream_wildcard_mentions(messages_without_everyone_mentions[i]));
}
for (i = 0; i < messages_without_stream_mentions.length; i += 1) {
assert.ok(!util.find_wildcard_mentions(messages_without_stream_mentions[i]));
}
for (i = 0; i < messages_without_topic_mentions.length; i += 1) {
assert.ok(!util.find_wildcard_mentions(messages_without_topic_mentions[i]));
assert.ok(!util.find_stream_wildcard_mentions(messages_without_stream_mentions[i]));
}
});