Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Add move_messages_between_streams_limit_seconds element in UI.
Sahil Batra2eb204f69974
diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.jsindex 5917dbb67ab..d6918bdab12 100644--- a/frontend_tests/node_tests/settings_org.js+++ b/frontend_tests/node_tests/settings_org.js@@ -535,6 +535,9 @@ test("set_up", ({override, override_rewire}) => {$("#id_realm_move_messages_within_stream_limit_minutes").set_parent($.create("<stub move within stream custom input parent>"),);+ $("#id_realm_move_messages_between_streams_limit_minutes").set_parent(+ $.create("<stub move between streams custom input parent>"),+ );$("#id_realm_message_content_delete_limit_minutes").set_parent($.create("<stub delete limit custom input parent>"),);@@ -550,6 +553,13 @@ test("set_up", ({override, override_rewire}) => {$stub_move_within_stream_limit_parent,);+ const $stub_move_between_streams_limit_parent = $.create(+ "<stub move_between_streams_limit parent",+ );+ $("#id_realm_move_messages_between_streams_limit_seconds").set_parent(+ $stub_move_between_streams_limit_parent,+ );+const $stub_message_content_delete_limit_parent = $.create("<stub message_content_delete_limit parent",);@@ -576,6 +586,18 @@ test("set_up", ({override, override_rewire}) => {"id_realm_move_messages_within_stream_limit_minutes",);+ const $custom_move_between_streams_limit_input = $(+ "#id_realm_move_messages_between_streams_limit_minutes",+ );+ $stub_move_between_streams_limit_parent.set_find_results(+ ".time-limit-custom-input",+ $custom_move_between_streams_limit_input,+ );+ $custom_move_between_streams_limit_input.attr(+ "id",+ "id_realm_move_messages_between_streams_limit_minutes",+ );+const $custom_delete_limit_input = $("#id_realm_message_content_delete_limit_minutes");$stub_message_content_delete_limit_parent.set_find_results(".time-limit-custom-input",diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.jsindex f5a2079022a..1d25156929b 100644--- a/static/js/server_events_dispatch.js+++ b/static/js/server_events_dispatch.js@@ -211,6 +211,7 @@ export function dispatch_normal_event(event) {mandatory_topics: noop,message_content_edit_limit_seconds: noop,message_content_delete_limit_seconds: noop,+ move_messages_between_streams_limit_seconds: noop,move_messages_within_stream_limit_seconds: noop,message_retention_days: noop,move_messages_between_streams_policy: noop,diff --git a/static/js/settings_org.js b/static/js/settings_org.jsindex b40dcab9768..cbc7a84e847 100644--- a/static/js/settings_org.js+++ b/static/js/settings_org.js@@ -363,7 +363,15 @@ function enable_or_disable_related_message_move_time_limit_setting(setting_name,function set_msg_move_limit_setting(property_name) {set_time_limit_setting(property_name);- const disable_setting = message_move_limit_setting_enabled("realm_edit_topic_policy");++ let disable_setting;+ if (property_name === "realm_move_messages_within_stream_limit_seconds") {+ disable_setting = message_move_limit_setting_enabled("realm_edit_topic_policy");+ } else {+ disable_setting = message_move_limit_setting_enabled(+ "realm_move_messages_between_streams_policy",+ );+ }enable_or_disable_related_message_move_time_limit_setting(property_name, disable_setting);}@@ -673,6 +681,7 @@ export function discard_property_element_changes(elem, for_realm_default_settingset_time_limit_setting(property_name);break;case "realm_move_messages_within_stream_limit_seconds":+ case "realm_move_messages_between_streams_limit_seconds":set_msg_move_limit_setting(property_name);break;case "realm_message_retention_days":@@ -928,6 +937,7 @@ export function check_property_changed(elem, for_realm_default_settings, sub) {break;case "realm_message_content_edit_limit_seconds":case "realm_message_content_delete_limit_seconds":+ case "realm_move_messages_between_streams_limit_seconds":case "realm_move_messages_within_stream_limit_seconds":case "realm_waiting_period_threshold":proposed_val = get_time_limit_setting_value($elem, false);@@ -1225,6 +1235,7 @@ export function build_page() {set_giphy_rating_dropdown();set_msg_edit_limit_dropdown();set_msg_move_limit_setting("realm_move_messages_within_stream_limit_seconds");+ set_msg_move_limit_setting("realm_move_messages_between_streams_limit_seconds");set_msg_delete_limit_dropdown();set_delete_own_message_policy_dropdown(page_params.realm_delete_own_message_policy);set_message_retention_setting_dropdown();@@ -1250,6 +1261,10 @@ export function build_page() {update_custom_value_input("realm_message_content_edit_limit_seconds");});+ $("#id_realm_move_messages_between_streams_limit_seconds").on("change", () => {+ update_custom_value_input("realm_move_messages_between_streams_limit_seconds");+ });+$("#id_realm_move_messages_within_stream_limit_seconds").on("change", () => {update_custom_value_input("realm_move_messages_within_stream_limit_seconds");});@@ -1304,7 +1319,13 @@ export function build_page() {const $policy_dropdown_elem = $(e.target);const property_name = extract_property_name($policy_dropdown_elem);const disable_time_limit_setting = message_move_limit_setting_enabled(property_name);- const time_limit_setting_name = "realm_move_messages_within_stream_limit_seconds";++ let time_limit_setting_name;+ if (property_name === "realm_edit_topic_policy") {+ time_limit_setting_name = "realm_move_messages_within_stream_limit_seconds";+ } else {+ time_limit_setting_name = "realm_move_messages_between_streams_limit_seconds";+ }enable_or_disable_related_message_move_time_limit_setting(time_limit_setting_name,diff --git a/static/styles/settings.css b/static/styles/settings.cssindex 273d2a7959f..45d684c7b99 100644--- a/static/styles/settings.css+++ b/static/styles/settings.css@@ -1482,7 +1482,8 @@ $option_title_width: 180px;#id_realm_message_content_edit_limit_seconds,#id_realm_delete_own_message_policy,#id_realm_message_content_delete_limit_seconds,-#id_realm_move_messages_within_stream_limit_seconds {+#id_realm_move_messages_within_stream_limit_seconds,+#id_realm_move_messages_between_streams_limit_seconds {width: 325px;}diff --git a/static/templates/settings/organization_permissions_admin.hbs b/static/templates/settings/organization_permissions_admin.hbsindex 3eeb3bf303b..c545cb01b48 100644--- a/static/templates/settings/organization_permissions_admin.hbs+++ b/static/templates/settings/organization_permissions_admin.hbs@@ -217,10 +217,28 @@<div class="input-group"><label for="realm_move_messages_between_streams_policy">{{t "Who can move messages to another stream" }}</label>- <select name="realm_move_messages_between_streams_policy" class="setting-widget prop-element bootstrap-focus-style" id="id_realm_move_messages_between_streams_policy" data-setting-widget-type="number">+ <select name="realm_move_messages_between_streams_policy" class="setting-widget prop-element bootstrap-focus-style move-message-policy-setting" id="id_realm_move_messages_between_streams_policy" data-setting-widget-type="number">{{> dropdown_options_widget option_values=move_messages_between_streams_policy_values}}</select></div>++ <div class="input-group time-limit-setting">+ <label for="realm_move_messages_between_streams_limit_seconds" class="dropdown-title">{{t "Time limit for moving messages between streams" }} <i>({{t "does not apply to moderators and administrators" }})</i></label>+ <select name="realm_move_messages_between_streams_limit_seconds" id="id_realm_move_messages_between_streams_limit_seconds" class="prop-element bootstrap-focus-style" data-setting-widget-type="time-limit">+ {{#each msg_move_limit_dropdown_values}}+ <option value="{{value}}">{{text}}</option>+ {{/each}}+ </select>+ <div class="dependent-settings-block">+ <label for="id_realm_move_messages_between_streams_limit_minutes" class="inline-block realm-time-limit-label">+ {{t 'Duration editing is allowed after posting (minutes)'}}: + </label>+ <input type="text" id="id_realm_move_messages_between_streams_limit_minutes"+ name="realm_move_messages_between_streams_limit_minutes"+ class="time-limit-custom-input"+ autocomplete="off"/>+ </div>+ </div></div><div id="org-msg-deletion" class="settings-subsection-parent">