stream settings: Rearrange personal stream settings.

We rearrange the personal stream settings to show all the
notification settings together under a separate heading.

Fixes #19508.
This commit is contained in:
Sahil Batra 2021-08-06 13:15:45 +05:30 committed by Tim Abbott
parent 4deb9dc834
commit 0e5b2326b2
2 changed files with 30 additions and 3 deletions

View File

@ -517,10 +517,21 @@ export function show_settings_for(node) {
const slim_sub = sub_store.get(stream_id); const slim_sub = sub_store.get(stream_id);
stream_data.clean_up_description(slim_sub); stream_data.clean_up_description(slim_sub);
const sub = stream_settings_data.get_sub_for_settings(slim_sub); const sub = stream_settings_data.get_sub_for_settings(slim_sub);
const all_settings = stream_settings(sub);
const other_settings = [];
const notification_settings = all_settings.filter((setting) => {
if (setting.is_notification_setting) {
return true;
}
other_settings.push(setting);
return false;
});
const html = render_stream_settings({ const html = render_stream_settings({
sub, sub,
settings: stream_settings(sub), notification_settings,
other_settings,
stream_post_policy_values: stream_data.stream_post_policy_values, stream_post_policy_values: stream_data.stream_post_policy_values,
message_retention_text: get_retention_policy_text_for_subscription_type(sub), message_retention_text: get_retention_policy_text_for_subscription_type(sub),
}); });

View File

@ -76,14 +76,14 @@
</div> </div>
<div class="subscription-config"> <div class="subscription-config">
<ul class="grey-box"> <ul class="grey-box">
{{#each settings}} {{#each other_settings}}
<li> <li>
{{> stream_settings_checkbox {{> stream_settings_checkbox
setting_name=name setting_name=name
is_checked=is_checked is_checked=is_checked
is_muted=(lookup ../sub "is_muted") is_muted=(lookup ../sub "is_muted")
stream_id=(lookup ../sub "stream_id") stream_id=(lookup ../sub "stream_id")
notification_setting=is_notification_setting notification_setting=false
disabled_realm_setting=disabled_realm_setting disabled_realm_setting=disabled_realm_setting
is_disabled=is_disabled is_disabled=is_disabled
label=label}} label=label}}
@ -96,6 +96,22 @@
</span> </span>
</li> </li>
</ul> </ul>
<h4>{{t "Notification settings" }}</h4>
<ul class="grey-box">
{{#each notification_settings}}
<li>
{{> stream_settings_checkbox
setting_name=name
is_checked=is_checked
is_muted=(lookup ../sub "is_muted")
stream_id=(lookup ../sub "stream_id")
notification_setting=true
disabled_realm_setting=disabled_realm_setting
is_disabled=is_disabled
label=label}}
</li>
{{/each}}
</ul>
</div> </div>
</div> </div>