diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index af7891d975..b1f5a092c9 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -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); }); diff --git a/static/js/stream_data.js b/static/js/stream_data.js index 06efc17a9c..847484a38b 100644 --- a/static/js/stream_data.js +++ b/static/js/stream_data.js @@ -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; }