mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
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:
@@ -992,4 +992,7 @@ test("can_post_messages_in_stream", () => {
|
||||
|
||||
social.stream_post_policy = stream_data.stream_post_policy_values.everyone.code;
|
||||
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) {
|
||||
if (page_params.is_spectator) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (page_params.is_admin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user