mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
stream_edit: Fetch subscribers before showing subscriber tab.
Work towards #34244. Now that we're supporting partial subscriber data, we might need to fetch the full list of subscribers when opening the subscribers tab of the edit channel modal. This commit handles a slow load with a loading spinner while we fetch the data, and also makes sure to ignore the data if it's received after it stops being relevant (in case the user has another stream's data open).
This commit is contained in:
@@ -302,6 +302,19 @@ test("maybe_fetch_stream_subscribers", async () => {
|
||||
assert.equal(await peer_data.maybe_fetch_is_user_subscribed(india.stream_id, 2, false), true);
|
||||
assert.equal(await peer_data.maybe_fetch_is_user_subscribed(india.stream_id, 5, false), false);
|
||||
|
||||
peer_data.clear_for_testing();
|
||||
assert.deepEqual(await peer_data.get_subscribers(india.stream_id), []);
|
||||
assert.deepEqual(await peer_data.get_all_subscribers(india.stream_id), [1, 2, 3, 4]);
|
||||
|
||||
peer_data.clear_for_testing();
|
||||
channel.get = () => {
|
||||
throw new Error("error");
|
||||
};
|
||||
blueslip.expect("error", "Failure fetching channel subscribers");
|
||||
// retry is false, so we get null because there was an error
|
||||
assert.deepEqual(await peer_data.get_all_subscribers(india.stream_id, false), null);
|
||||
blueslip.reset();
|
||||
|
||||
channel.get = () => {
|
||||
throw new Error("error");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user