Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stream_data: Set can_toggle_subscription to false for spectator.

Aman Agrawal0bde50b85156
diff --git a/static/js/stream_data.js b/static/js/stream_data.js
index 36370bbae8a..91137c2025b 100644
--- a/static/js/stream_data.js
+++ b/static/js/stream_data.js
@@ -522,12 +522,15 @@ export function can_toggle_subscription(sub) {
//
// One can only join a stream if it is public (!invite_only) and
// your role is Member or above (!is_guest).
+ // Spectators cannot subscribe to any streams.
//
// Note that the correctness of this logic relies on the fact that
// one cannot be subscribed to a deactivated stream, and
// deactivated streams are automatically made private during the
// archive stream process.
- return sub.subscribed || (!page_params.is_guest && !sub.invite_only);
+ return (
+ (sub.subscribed || (!page_params.is_guest && !sub.invite_only)) && !page_params.is_spectator
+ );
}
export function can_preview(sub) {