mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
refactor: Extract peer_data.js.
This de-clutters stream_data a bit. Since our peer data is our biggest performance concern, I want to contain any optimizations to a fairly well-focused module. The name `peer_data` is a bit of a compromise, since we already have `subs.js` and we use `sub` as a variable name for stream records throughout our code, but it's consistent with our event nomenclature (peer/add, peer/remove) and it's short while still being fairly easy to find with grep.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const peer_data = require("./peer_data");
|
||||
|
||||
function display_pill(sub) {
|
||||
return "#" + sub.name + ": " + sub.subscriber_count + " users";
|
||||
}
|
||||
@@ -39,7 +41,7 @@ function get_user_ids_from_subs(items) {
|
||||
for (const item of items) {
|
||||
// only some of our items have streams (for copy-from-stream)
|
||||
if (item.stream_id !== undefined) {
|
||||
user_ids = user_ids.concat(stream_data.get_subscribers(item.stream_id));
|
||||
user_ids = user_ids.concat(peer_data.get_subscribers(item.stream_id));
|
||||
}
|
||||
}
|
||||
return user_ids;
|
||||
|
||||
Reference in New Issue
Block a user