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

@@ -958,14 +958,13 @@ export function save_message_row_edit($row) {
changed = old_content !== new_content;
}
const already_has_wildcard_mention =
message.stream_wildcard_mentioned || message.topic_wildcard_mentioned;
if (!already_has_wildcard_mention) {
const wildcard_mention = util.find_wildcard_mentions(new_content);
const already_has_stream_wildcard_mention = message.stream_wildcard_mentioned;
if (!already_has_stream_wildcard_mention) {
const stream_wildcard_mention = util.find_stream_wildcard_mentions(new_content);
const is_stream_message_mentions_valid = compose_validate.validate_stream_message_mentions({
stream_id,
$banner_container,
wildcard_mention,
stream_wildcard_mention,
});
if (!is_stream_message_mentions_valid) {