compose: Improved warning for wildcard mentions.

Edited the warning to clearly state that most members/most stream members
will be notified on using wildcard mentions, along with the specific
mention (e.g. @ALL, @everyone and @stream).

Did a separate check for all wildcard mentions in util.js and stored the
corresponding mention in wildcard_mention inside compose.js.

Fixes: #13636
This commit is contained in:
Vaibhav Raj Singh
2020-01-23 11:52:26 +05:30
committed by Tim Abbott
parent 23a5cf41dc
commit 1fa46b1963
6 changed files with 48 additions and 22 deletions

View File

@@ -209,9 +209,12 @@ exports.CachedValue.prototype = {
},
};
exports.is_all_or_everyone_mentioned = function (message_content) {
const all_everyone_re = /(^|\s)(@\*{2}(all|everyone|stream)\*{2})($|\s)/;
return all_everyone_re.test(message_content);
exports.find_wildcard_mentions = function (message_content) {
const mention = message_content.match(/(^|\s)(@\*{2}(all|everyone|stream)\*{2})($|\s)/);
if (mention === null) {
return null;
}
return mention[3];
};
exports.move_array_elements_to_front = function util_move_array_elements_to_front(array, selected) {