mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
refactor: Remove maybe_clear_subscribers().
The maybe_clear_subscribers() function was an artifact of when we used to attach subscribers to the "sub" records in stream_data.js. I think it was basically a refactoring shim, and due to some other recent cleanup, it was only used in test code. We also change how we validate stream ids. Going forward, peer_data just looks up stream_ids with the normal stream_data API when it's trying to warn about rogue stream_ids coming in. As I alluded to in an earlier commit, some of the warning code here might be overly defensive, but at least it's pretty self-contained.
This commit is contained in:
@@ -972,6 +972,8 @@ run_test("warn_if_private_stream_is_linked", () => {
|
||||
stream_id: 100,
|
||||
name: "Denmark",
|
||||
};
|
||||
stream_data.add_sub(denmark);
|
||||
|
||||
peer_data.set_subscribers(denmark.stream_id, [1, 2, 3]);
|
||||
|
||||
function test_noop_case(invite_only) {
|
||||
|
||||
@@ -240,7 +240,11 @@ run_test("get_subscriber_count", () => {
|
||||
|
||||
run_test("is_subscriber_subset", () => {
|
||||
function make_sub(stream_id, user_ids) {
|
||||
const sub = {stream_id};
|
||||
const sub = {
|
||||
stream_id,
|
||||
name: `stream ${stream_id}`,
|
||||
};
|
||||
stream_data.add_sub(sub);
|
||||
peer_data.set_subscribers(sub.stream_id, user_ids);
|
||||
return sub;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user