mirror of https://github.com/zulip/zulip.git
stream_ui_updates: Extract `update_change_stream_privacy_settings`.
This commit is contained in:
parent
ecc165b899
commit
7a168216ff
|
@ -384,9 +384,7 @@ function change_stream_privacy(e) {
|
|||
|
||||
// For auto update, without rendering whole template
|
||||
stream_data.update_calculated_fields(sub);
|
||||
if (!sub.can_change_stream_permissions) {
|
||||
$(".change-stream-privacy").hide();
|
||||
}
|
||||
stream_ui_updates.update_change_stream_privacy_settings(sub);
|
||||
},
|
||||
error: function () {
|
||||
$("#change-stream-privacy-button").text(i18n.t("Try again"));
|
||||
|
|
|
@ -44,6 +44,16 @@ exports.update_regular_sub_settings = function (sub) {
|
|||
}
|
||||
};
|
||||
|
||||
exports.update_change_stream_privacy_settings = function (sub) {
|
||||
var stream_privacy_btn = $(".change-stream-privacy");
|
||||
|
||||
if (sub.can_change_stream_permissions) {
|
||||
stream_privacy_btn.show();
|
||||
} else {
|
||||
stream_privacy_btn.hide();
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
}());
|
||||
|
||||
|
|
|
@ -266,10 +266,8 @@ exports.update_settings_for_subscribed = function (sub) {
|
|||
exports.rerender_subscribers_count(sub, true);
|
||||
stream_ui_updates.update_check_button_for_sub(sub);
|
||||
stream_ui_updates.update_settings_button_for_sub(sub);
|
||||
stream_ui_updates.update_change_stream_privacy_settings(sub);
|
||||
|
||||
if (sub.can_change_stream_permissions) {
|
||||
$(".change-stream-privacy").show();
|
||||
}
|
||||
} else {
|
||||
exports.add_sub_to_table(sub);
|
||||
}
|
||||
|
@ -348,9 +346,7 @@ exports.update_settings_for_unsubscribed = function (sub) {
|
|||
stream_ui_updates.update_check_button_for_sub(sub);
|
||||
stream_ui_updates.update_settings_button_for_sub(sub);
|
||||
stream_ui_updates.update_regular_sub_settings(sub);
|
||||
if (!sub.can_change_stream_permissions) {
|
||||
$(".change-stream-privacy").hide();
|
||||
}
|
||||
stream_ui_updates.update_change_stream_privacy_settings(sub);
|
||||
|
||||
stream_data.update_stream_email_address(sub, "");
|
||||
if (stream_edit.is_sub_settings_active(sub)) {
|
||||
|
|
Loading…
Reference in New Issue