mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
stream_events: refactor the peer add/remove code path.
This commit is a prep commit for implementing the live update of user profile streams list. Since the code for both adding and removing peers is the same after adding or removing the peer data, it is better to extract that code to reduce duplication in a new function called 'process_subscriber_update'.
This commit is contained in:
committed by
Tim Abbott
parent
bb6fe0385e
commit
45569539c5
@@ -9,7 +9,6 @@ import * as bot_data from "./bot_data";
|
||||
import * as browser_history from "./browser_history";
|
||||
import {buddy_list} from "./buddy_list";
|
||||
import * as compose from "./compose";
|
||||
import * as compose_fade from "./compose_fade";
|
||||
import * as compose_pm_pill from "./compose_pm_pill";
|
||||
import * as compose_recipient from "./compose_recipient";
|
||||
import * as composebox_typeahead from "./composebox_typeahead";
|
||||
@@ -590,13 +589,7 @@ export function dispatch_normal_event(event) {
|
||||
const user_ids = people.validate_user_ids(event.user_ids);
|
||||
|
||||
peer_data.bulk_add_subscribers({stream_ids, user_ids});
|
||||
|
||||
for (const stream_id of stream_ids) {
|
||||
const sub = sub_store.get(stream_id);
|
||||
stream_settings_ui.update_subscribers_ui(sub);
|
||||
}
|
||||
|
||||
compose_fade.update_faded_users();
|
||||
stream_events.process_subscriber_update(stream_ids);
|
||||
break;
|
||||
}
|
||||
case "peer_remove": {
|
||||
@@ -604,13 +597,7 @@ export function dispatch_normal_event(event) {
|
||||
const user_ids = people.validate_user_ids(event.user_ids);
|
||||
|
||||
peer_data.bulk_remove_subscribers({stream_ids, user_ids});
|
||||
|
||||
for (const stream_id of stream_ids) {
|
||||
const sub = sub_store.get(stream_id);
|
||||
stream_settings_ui.update_subscribers_ui(sub);
|
||||
}
|
||||
|
||||
compose_fade.update_faded_users();
|
||||
stream_events.process_subscriber_update(stream_ids);
|
||||
break;
|
||||
}
|
||||
case "remove":
|
||||
|
||||
Reference in New Issue
Block a user