mirror of https://github.com/zulip/zulip.git
streams: Return early from can_post_messages_in_stream for spectators.
This code path isn't currently reached for the logged out "spectator" view, but it will be in upcoming commits. This makes sure that case is handled properly.
This commit is contained in:
parent
763dfbdcfb
commit
3d4374f2a6
|
@ -992,4 +992,7 @@ test("can_post_messages_in_stream", () => {
|
||||||
|
|
||||||
social.stream_post_policy = stream_data.stream_post_policy_values.everyone.code;
|
social.stream_post_policy = stream_data.stream_post_policy_values.everyone.code;
|
||||||
assert.equal(stream_data.can_post_messages_in_stream(social), true);
|
assert.equal(stream_data.can_post_messages_in_stream(social), true);
|
||||||
|
|
||||||
|
page_params.is_spectator = true;
|
||||||
|
assert.equal(stream_data.can_post_messages_in_stream(social), false);
|
||||||
});
|
});
|
||||||
|
|
|
@ -557,6 +557,10 @@ export function can_subscribe_others(sub) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function can_post_messages_in_stream(stream) {
|
export function can_post_messages_in_stream(stream) {
|
||||||
|
if (page_params.is_spectator) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (page_params.is_admin) {
|
if (page_params.is_admin) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue