mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
stream_settings: Add stream "reset to default notifications" button.
This commit introduces a "reset to default notifications" button to the personal panel in stream settings. On clicking, it unmutes the current stream and resets all its notification configurations to default user settings. Fixes zulip#27624.
This commit is contained in:
committed by
Tim Abbott
parent
3975c508b5
commit
f4260cf40d
@@ -289,6 +289,25 @@ export function update_muting_rendering(sub) {
|
|||||||
$edit_container.find(".mute-note").toggleClass("hide-mute-note", !sub.is_muted);
|
$edit_container.find(".mute-note").toggleClass("hide-mute-note", !sub.is_muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stream_notification_reset(e) {
|
||||||
|
const sub = get_sub_for_target(e.target);
|
||||||
|
const data = [{stream_id: sub.stream_id, property: "is_muted", value: false}];
|
||||||
|
for (const [per_stream_setting_name, global_setting_name] of Object.entries(
|
||||||
|
settings_config.generalize_stream_notification_setting,
|
||||||
|
)) {
|
||||||
|
data.push({
|
||||||
|
stream_id: sub.stream_id,
|
||||||
|
property: per_stream_setting_name,
|
||||||
|
value: user_settings[global_setting_name],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
stream_settings_api.bulk_set_stream_property(
|
||||||
|
data,
|
||||||
|
$(`#stream_change_property_status${CSS.escape(sub.stream_id)}`),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function stream_is_muted_changed(e) {
|
function stream_is_muted_changed(e) {
|
||||||
const sub = get_sub_for_target(e.target);
|
const sub = get_sub_for_target(e.target);
|
||||||
if (!sub) {
|
if (!sub) {
|
||||||
@@ -537,6 +556,12 @@ export function initialize() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#streams_overlay_container").on(
|
||||||
|
"click",
|
||||||
|
".subsection-parent .reset-stream-notifications-button",
|
||||||
|
stream_notification_reset,
|
||||||
|
);
|
||||||
|
|
||||||
$("#streams_overlay_container").on(
|
$("#streams_overlay_container").on(
|
||||||
"change",
|
"change",
|
||||||
"#sub_is_muted_setting .sub_setting_control",
|
"#sub_is_muted_setting .sub_setting_control",
|
||||||
|
|||||||
@@ -125,6 +125,9 @@
|
|||||||
<h4 class="stream_setting_subsection_title">{{t "Notification settings" }}</h4>
|
<h4 class="stream_setting_subsection_title">{{t "Notification settings" }}</h4>
|
||||||
<p>{{t "In muted streams, stream notification settings apply only to unmuted topics." }}</p>
|
<p>{{t "In muted streams, stream notification settings apply only to unmuted topics." }}</p>
|
||||||
<div class="subsection-parent">
|
<div class="subsection-parent">
|
||||||
|
<div class="input-group">
|
||||||
|
<button class="button small rounded reset-stream-notifications-button" type="button">{{t "Reset to default notifications" }}</button>
|
||||||
|
</div>
|
||||||
{{#each notification_settings}}
|
{{#each notification_settings}}
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
{{> stream_settings_checkbox
|
{{> stream_settings_checkbox
|
||||||
|
|||||||
Reference in New Issue
Block a user