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:
Tim Abbott
2018-03-09 17:59:13 -08:00
parent cc2eb60ca5
commit c5904499db
2 changed files with 2 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -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();
}