Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Set wildcard_mention for message before further validation.

sahil83904ef6ba63a76
diff --git a/static/js/compose.js b/static/js/compose.js
index 0e0a5a35795..6424cd4e9bf 100644
--- a/static/js/compose.js
+++ b/static/js/compose.js
@@ -463,7 +463,6 @@ function check_unsubscribed_stream_for_send(stream_name, autosubscribe) {
function validate_stream_message_mentions(stream_id) {
const stream_count = stream_data.get_subscriber_count(stream_id) || 0;
- wildcard_mention = util.find_wildcard_mentions(compose_state.message_content());
// check if wildcard_mention has any mention and henceforth execute the warning message.
if (wildcard_mention !== null && stream_count > exports.all_everyone_warn_threshold) {
@@ -595,6 +594,11 @@ function validate_stream_message() {
return false;
}
+ /* Note: This is a global and thus accessible in the functions
+ below; it's important that we update this state here before
+ proceeding with further validation. */
+ wildcard_mention = util.find_wildcard_mentions(compose_state.message_content());
+
// If both `@all` is mentioned and it's in `#announce`, just validate
// for `@all`. Users shouldn't have to hit "yes" more than once.
if (wildcard_mention !== null && stream_name === "announce") {