mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
stream_data: Fix exception when notifications_stream is private.
If notifications_stream is private and the current user has never been subscribed, then we would throw an exception when trying to look up notifications_stream. In this situation, we should just treat it like the stream doesn't exist for the purposes of this user.
This commit is contained in:
@@ -645,6 +645,13 @@ zrequire('marked', 'third/marked/lib/marked');
|
||||
assert(!page_params.never_subscribed);
|
||||
assert.equal(page_params.notifications_stream, "");
|
||||
|
||||
// Simulate a private stream the user isn't subscribed to
|
||||
initialize();
|
||||
page_params.realm_notifications_stream_id = 89;
|
||||
stream_data.initialize_from_page_params();
|
||||
assert.equal(page_params.notifications_stream, "");
|
||||
|
||||
// Now actually subscribe the user to the stream
|
||||
initialize();
|
||||
var foo = {
|
||||
name: 'foo',
|
||||
@@ -652,7 +659,6 @@ zrequire('marked', 'third/marked/lib/marked');
|
||||
};
|
||||
|
||||
stream_data.add_sub('foo', foo);
|
||||
page_params.realm_notifications_stream_id = 89;
|
||||
stream_data.initialize_from_page_params();
|
||||
|
||||
assert.equal(page_params.notifications_stream, "foo");
|
||||
|
||||
Reference in New Issue
Block a user