stream-settings: Avoid duplicate IDs for setting elements.

We previously had same ID for setting elements in stream
creation and stream edit form. This commit adds "new_"
prefix before the setting name to avoid duplicate IDs.
This commit is contained in:
Sahil Batra 2024-11-14 15:32:05 +05:30 committed by Tim Abbott
parent b6ebf143cc
commit 46defdfcfb
4 changed files with 9 additions and 7 deletions

View File

@ -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",
);
},

View File

@ -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>

View File

@ -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">

View File

@ -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>