compose: Rename all_everyone_warn_threshold.

We rename all_everyone_warn_threshold to
wildcard_mention_large_stream_threshold as we would
be adding wildcard_mention_policy and this
constant will also be used to show error
in case when wildcard_mention_policy is set
to admins only.
This commit is contained in:
sahil839
2020-09-14 23:59:40 +05:30
committed by Tim Abbott
parent 46babbe9e1
commit 44cee1428a
2 changed files with 7 additions and 4 deletions

View File

@@ -19,8 +19,8 @@ async function test_mention(page) {
console.log("Checking for all everyone warning"); console.log("Checking for all everyone warning");
const stream_size = await page.evaluate(() => stream_data.get_sub("Verona").subscribers.size); const stream_size = await page.evaluate(() => stream_data.get_sub("Verona").subscribers.size);
const threshold = await page.evaluate(() => { const threshold = await page.evaluate(() => {
compose.all_everyone_warn_threshold = 5; compose.wildcard_mention_large_stream_threshold = 5;
return compose.all_everyone_warn_threshold; return compose.wildcard_mention_large_stream_threshold;
}); });
assert(stream_size > threshold); assert(stream_size > threshold);
await page.click("#compose-send-button"); await page.click("#compose-send-button");

View File

@@ -27,7 +27,7 @@ let user_acknowledged_announce;
let wildcard_mention; let wildcard_mention;
let uppy; let uppy;
exports.all_everyone_warn_threshold = 15; exports.wildcard_mention_large_stream_threshold = 15;
exports.announce_warn_threshold = 60; exports.announce_warn_threshold = 60;
exports.uploads_domain = document.location.protocol + "//" + document.location.host; exports.uploads_domain = document.location.protocol + "//" + document.location.host;
@@ -485,7 +485,10 @@ function validate_stream_message_mentions(stream_id) {
const stream_count = stream_data.get_subscriber_count(stream_id) || 0; const stream_count = stream_data.get_subscriber_count(stream_id) || 0;
// check if wildcard_mention has any mention and henceforth execute the warning message. // check if wildcard_mention has any mention and henceforth execute the warning message.
if (wildcard_mention !== null && stream_count > exports.all_everyone_warn_threshold) { if (
wildcard_mention !== null &&
stream_count > exports.wildcard_mention_large_stream_threshold
) {
if ( if (
user_acknowledged_all_everyone === undefined || user_acknowledged_all_everyone === undefined ||
user_acknowledged_all_everyone === false user_acknowledged_all_everyone === false