mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
stream_data: Move calls to update_calculated_fields to events layer.
This migrates what were effectively data update functions to be called from the main stream_events handlers, instead of being called from the view-update code in subs.js.
This commit is contained in:
@@ -105,6 +105,7 @@ exports.mark_subscribed = function (sub, subscribers, color) {
|
||||
if (subscribers) {
|
||||
stream_data.set_subscribers(sub, subscribers);
|
||||
}
|
||||
stream_data.update_calculated_fields(sub);
|
||||
|
||||
if (overlays.streams_open()) {
|
||||
subs.update_settings_for_subscribed(sub);
|
||||
@@ -128,7 +129,7 @@ exports.mark_unsubscribed = function (sub) {
|
||||
return;
|
||||
} else if (sub.subscribed) {
|
||||
stream_data.unsubscribe_myself(sub);
|
||||
|
||||
stream_data.update_calculated_fields(sub);
|
||||
if (overlays.streams_open()) {
|
||||
subs.update_settings_for_unsubscribed(sub);
|
||||
}
|
||||
|
||||
@@ -179,7 +179,6 @@ function add_email_hint(row, email_address_hint_content) {
|
||||
// this request. These should be appended to the top of the list so
|
||||
// they are more visible.
|
||||
function add_sub_to_table(sub) {
|
||||
stream_data.update_calculated_fields(sub);
|
||||
var html = templates.render('subscription', sub);
|
||||
var settings_html = templates.render('subscription_settings', sub);
|
||||
if (stream_create.get_name() === sub.name) {
|
||||
@@ -248,7 +247,6 @@ exports.update_settings_for_unsubscribed = function (sub) {
|
||||
|
||||
// If user unsubscribed from private stream then user can not subscribe to
|
||||
// stream without invitation. So hide subscribe button.
|
||||
stream_data.update_calculated_fields(sub);
|
||||
if (!sub.should_display_subscription_button) {
|
||||
settings_button.hide();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user