Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Remove validation for stream named "announce".
Sahil Batra74476317fd8a
diff --git a/static/js/compose.js b/static/js/compose.jsindex 829220cb9e1..f6e553598d2 100644--- a/static/js/compose.js+++ b/static/js/compose.js@@ -440,15 +440,6 @@ export function initialize() {finish();});- $("#compose-announce").on("click", ".compose-announce-confirm", (event) => {- event.preventDefault();-- $(event.target).parents(".compose-announce").remove();- compose_validate.set_user_acknowledged_announce_flag(true);- compose_validate.clear_announce_warnings();- finish();- });-$("#compose-send-status").on("click", ".sub_unsub_button", (event) => {event.preventDefault();diff --git a/static/js/compose_actions.js b/static/js/compose_actions.jsindex eff1546dbb9..1dc51d05a8a 100644--- a/static/js/compose_actions.js+++ b/static/js/compose_actions.js@@ -109,10 +109,8 @@ function clear_box() {// TODO: Better encapsulate at-mention warnings.compose_validate.clear_topic_resolved_warning();compose_validate.clear_all_everyone_warnings();- compose_validate.clear_announce_warnings();compose.clear_private_stream_alert();compose_validate.set_user_acknowledged_all_everyone_flag(undefined);- compose_validate.set_user_acknowledged_announce_flag(undefined);clear_textarea();compose_validate.check_overflow_text();diff --git a/static/js/compose_validate.js b/static/js/compose_validate.jsindex 9e23c833b2a..b68045bfae3 100644--- a/static/js/compose_validate.js+++ b/static/js/compose_validate.js@@ -2,7 +2,6 @@ import $ from "jquery";import * as resolved_topic from "../shared/js/resolved_topic";import render_compose_all_everyone from "../templates/compose_all_everyone.hbs";-import render_compose_announce from "../templates/compose_announce.hbs";import render_compose_invite_users from "../templates/compose_invite_users.hbs";import render_compose_not_subscribed from "../templates/compose_not_subscribed.hbs";import render_compose_private_stream_alert from "../templates/compose_private_stream_alert.hbs";@@ -24,10 +23,8 @@ import {user_settings} from "./user_settings";import * as util from "./util";let user_acknowledged_all_everyone = false;-let user_acknowledged_announce = false;let wildcard_mention;-export const announce_warn_threshold = 60;export let wildcard_mention_large_stream_threshold = 15;export function needs_subscribe_warning(user_id, stream_id) {@@ -241,34 +238,10 @@ export function clear_all_everyone_warnings() {$("#compose-send-status").hide();}-function show_announce_warnings(stream_id) {- const stream_count = peer_data.get_subscriber_count(stream_id) || 0;-- const announce_template = render_compose_announce({count: stream_count});- const $error_area_announce = $("#compose-announce");-- if (!$error_area_announce.is(":visible")) {- $error_area_announce.append(announce_template);- }-- $error_area_announce.show();- user_acknowledged_announce = false;-}--export function clear_announce_warnings() {- $("#compose-announce").hide();- $("#compose-announce").empty();- $("#compose-send-status").hide();-}-export function set_user_acknowledged_all_everyone_flag(value) {user_acknowledged_all_everyone = value;}-export function set_user_acknowledged_announce_flag(value) {- user_acknowledged_announce = value;-}-export function get_invalid_recipient_emails() {const private_recipients = util.extract_pm_recipients(compose_state.private_message_recipient(),@@ -404,27 +377,6 @@ function validate_stream_message_mentions(stream_id) {return true;}-function validate_stream_message_announce(sub) {- const stream_count = peer_data.get_subscriber_count(sub.stream_id) || 0;-- if (sub.name === "announce" && stream_count > announce_warn_threshold) {- if (user_acknowledged_announce === undefined || user_acknowledged_announce === false) {- // user has not seen a warning message yet if undefined- show_announce_warnings(sub.stream_id);-- $("#compose-send-button").prop("disabled", false);- compose_ui.hide_compose_spinner();- return false;- }- } else {- clear_announce_warnings();- }- // at this point, the user has acknowledged the warning- user_acknowledged_announce = undefined;-- return true;-}-export function validation_error(error_type, stream_name) {let response;@@ -511,24 +463,11 @@ function validate_stream_message() {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") {- if (- !validate_stream_message_address_info(stream_name) ||- !validate_stream_message_mentions(sub.stream_id)- ) {- return false;- }- // If either criteria isn't met, just do the normal validation.- } else {- if (- !validate_stream_message_address_info(stream_name) ||- !validate_stream_message_mentions(sub.stream_id) ||- !validate_stream_message_announce(sub)- ) {- return false;- }+ if (+ !validate_stream_message_address_info(stream_name) ||+ !validate_stream_message_mentions(sub.stream_id)+ ) {+ return false;}return true;diff --git a/static/styles/compose.css b/static/styles/compose.cssindex fbaa56efeb6..6c6d999b060 100644--- a/static/styles/compose.css+++ b/static/styles/compose.css@@ -279,7 +279,6 @@.compose_invite_user,.compose_private_stream_alert,.compose-all-everyone,-.compose-announce,.compose_not_subscribed {padding: 4px 0;display: flex;@@ -305,7 +304,6 @@.compose_resolved_topic_user_controls,.compose-all-everyone-controls,-.compose-announce-controls,.compose_invite_user_controls,.compose_private_stream_alert_controls {float: right;diff --git a/static/templates/compose.hbs b/static/templates/compose.hbsindex b3e57265819..4fc139ee1f6 100644--- a/static/templates/compose.hbs+++ b/static/templates/compose.hbs@@ -53,7 +53,6 @@<div id="compose_resolved_topic" class="alert home-error-bar"></div><div id="compose_invite_users" class="alert home-error-bar"></div><div id="compose-all-everyone" class="alert home-error-bar"></div>- <div id="compose-announce" class="alert home-error-bar"></div><div id="compose_not_subscribed" class="alert home-error-bar"></div><div id="compose_private_stream_alert" class="alert home-error-bar"></div><div id="out-of-view-notification" class="notification-alert"></div>diff --git a/static/templates/compose_announce.hbs b/static/templates/compose_announce.hbsdeleted file mode 100644index c8f2c199769..00000000000--- a/static/templates/compose_announce.hbs+++ /dev/null@@ -1,12 +0,0 @@-<div class="compose-announce">- <span class="compose-announce-msg">- {{#tr}}- This stream is reserved for <strong>announcements</strong>.- <br />- Are you sure you want to message all <strong>{count}</strong> people in this stream?- {{/tr}}- </span>- <span class="compose-announce-controls">- <button type="button" class="btn btn-warning compose-announce-confirm">{{t "Yes, send" }}</button>- </span>-</div>