mirror of https://github.com/zulip/zulip.git
left sidebar: Fix exceptions when updating sub data.
If the subscription data was changed from the left sidebar,
we previously would attempt to display the savings indicator
in the stream edit page which wasn't rendered yet. The bug was
introduced in commit 39577b58ba
.
This approach is used to harden the codepath against bugs by
keeping the expectOne check in `settings_ui.do_settings_change`
function.
Fixes #14467.
This commit is contained in:
parent
3a07febc20
commit
4ac633d432
|
@ -326,14 +326,14 @@ exports.stream_setting_clicked = function (e) {
|
|||
return;
|
||||
}
|
||||
|
||||
const sub = get_sub_for_target(e.target);
|
||||
let checkbox = $(e.currentTarget).find('.sub_setting_control');
|
||||
let status_element;
|
||||
let status_element = "#stream_change_property_status" + sub.stream_id;
|
||||
// sub data is being changed from the notification settings page.
|
||||
if (checkbox.length === 0) {
|
||||
checkbox = $(e.currentTarget);
|
||||
status_element = checkbox.closest('.subsection-parent').find('.alert-notification');
|
||||
}
|
||||
const sub = get_sub_for_target(e.target);
|
||||
const setting = checkbox.attr('name');
|
||||
if (!sub) {
|
||||
blueslip.error('undefined sub in stream_setting_clicked()');
|
||||
|
@ -353,11 +353,14 @@ exports.stream_setting_clicked = function (e) {
|
|||
};
|
||||
|
||||
exports.bulk_set_stream_property = function (sub_data, status_element) {
|
||||
const stream_id = sub_data[0].stream_id;
|
||||
const url = '/json/users/me/subscriptions/properties';
|
||||
const data = {subscription_data: JSON.stringify(sub_data)};
|
||||
if (!status_element) {
|
||||
status_element = "#stream_change_property_status" + stream_id;
|
||||
return channel.post({
|
||||
url: url,
|
||||
data: data,
|
||||
timeout: 10 * 1000,
|
||||
});
|
||||
}
|
||||
|
||||
settings_ui.do_settings_change(channel.post, url, data, status_element);
|
||||
|
|
Loading…
Reference in New Issue