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.

stream-settings: Avoid duplicate IDs for setting elements.

Sahil Batra46defdfcfbc7
diff --git a/web/src/stream_edit.ts b/web/src/stream_edit.ts
index a97a2f68fbf..2244c9cb74c 100644
--- a/web/src/stream_edit.ts
+++ b/web/src/stream_edit.ts
@@ -717,7 +717,7 @@ export function initialize(): void {
function (this: HTMLSelectElement) {
const message_retention_setting_dropdown_value = this.value;
settings_components.change_element_block_display_property(
- "stream_message_retention_custom_input",
+ "id_stream_message_retention_custom_input",
message_retention_setting_dropdown_value === "custom_period",
);
},
diff --git a/web/templates/stream_settings/stream_creation_form.hbs b/web/templates/stream_settings/stream_creation_form.hbs
index eb003286eec..69b94838eba 100644
--- a/web/templates/stream_settings/stream_creation_form.hbs
+++ b/web/templates/stream_settings/stream_creation_form.hbs
@@ -28,7 +28,8 @@
{{> stream_types .
stream_post_policy=stream_post_policy_values.everyone.code
is_stream_edit=false
- can_remove_subscribers_setting_widget_name="new_stream_can_remove_subscribers_group" }}
+ can_remove_subscribers_setting_widget_name="new_stream_can_remove_subscribers_group"
+ prefix="id_new_" }}
</div>
</section>
</div>
diff --git a/web/templates/stream_settings/stream_settings.hbs b/web/templates/stream_settings/stream_settings.hbs
index d6b7b5b24f2..552699db2a7 100644
--- a/web/templates/stream_settings/stream_settings.hbs
+++ b/web/templates/stream_settings/stream_settings.hbs
@@ -68,6 +68,7 @@
org_level_message_retention_setting=../org_level_message_retention_setting
is_stream_edit=true
can_remove_subscribers_setting_widget_name="can_remove_subscribers_group"
+ prefix="id_"
}}
{{/with}}
<div class="stream_details_box">
diff --git a/web/templates/stream_settings/stream_types.hbs b/web/templates/stream_settings/stream_types.hbs
index 2e8b75c455b..222c95e79e3 100644
--- a/web/templates/stream_settings/stream_types.hbs
+++ b/web/templates/stream_settings/stream_types.hbs
@@ -14,7 +14,7 @@
{{> ../help_link_widget link="/help/channel-permissions" }}
</label>
- <div class="stream-privacy_choices prop-element" id="id_stream_privacy" data-setting-widget-type="radio-group" data-setting-choice-type="string">
+ <div class="stream-privacy_choices prop-element" id="{{prefix}}stream_privacy" data-setting-widget-type="radio-group" data-setting-choice-type="string">
{{#each stream_privacy_policy_values}}
<div class="settings-radio-input-parent">
<label class="radio">
@@ -34,7 +34,7 @@
<div class="default-stream">
{{> ../settings/settings_checkbox
- prefix="id_"
+ prefix=prefix
setting_name="is_default_stream"
is_checked=check_default_stream
label=(t "Default channel for new users")
@@ -57,7 +57,7 @@
<label class="dropdown-title">{{t 'Who can post to this channel'}}
{{> ../help_link_widget link="/help/stream-sending-policy" }}
</label>
- <select name="stream-post-policy" class="stream_post_policy_setting prop-element settings_select bootstrap-focus-style" id="id_stream_post_policy" data-setting-widget-type="number">
+ <select name="stream-post-policy" class="stream_post_policy_setting prop-element settings_select bootstrap-focus-style" id="{{prefix}}stream_post_policy" data-setting-widget-type="number">
{{#each stream_post_policy_values}}
<option value="{{this.code}}" {{#if (eq this.code ../stream_post_policy) }}selected{{/if}}>
{{ this.description}}
@@ -82,7 +82,7 @@
<select name="stream_message_retention_setting"
class="stream_message_retention_setting prop-element settings_select bootstrap-focus-style"
- id="id_message_retention_days"
+ id="{{prefix}}message_retention_days"
data-setting-widget-type="message-retention-setting">
<option value="realm_default">{{t "Use organization level settings {org_level_message_retention_setting}" }}</option>
<option value="unlimited">{{t 'Retain forever' }}</option>
@@ -96,7 +96,7 @@
<input type="text" autocomplete="off"
name="stream-message-retention-days"
class="stream-message-retention-days message-retention-setting-custom-input time-limit-custom-input"
- id="stream_message_retention_custom_input" />
+ id="{{prefix}}stream_message_retention_custom_input" />
</div>
</div>
</div>