mirror of https://github.com/zulip/zulip.git
stream settings: Hide subscribe/unsubscribe as needed.
For public stream, always show subscription option. For private stream, if user is subscribed display unsubscribe option. If user is not subscribe, do not display subscription option.
This commit is contained in:
parent
690e82e624
commit
7ccaf2dc48
|
@ -170,6 +170,9 @@ exports.update_calculated_fields = function (sub) {
|
||||||
// stream is private and admin is subscribed to private stream.
|
// stream is private and admin is subscribed to private stream.
|
||||||
sub.can_change_name_description = page_params.is_admin &&
|
sub.can_change_name_description = page_params.is_admin &&
|
||||||
(!sub.invite_only || (sub.invite_only && sub.subscribed));
|
(!sub.invite_only || (sub.invite_only && sub.subscribed));
|
||||||
|
// If stream is public then any user can subscribe. If stream is private then only
|
||||||
|
// subscribed users can unsubscribe.
|
||||||
|
sub.should_display_subscription_button = !sub.invite_only || sub.subscribed;
|
||||||
sub.can_make_public = page_params.is_admin && sub.invite_only && sub.subscribed;
|
sub.can_make_public = page_params.is_admin && sub.invite_only && sub.subscribed;
|
||||||
sub.can_make_private = page_params.is_admin && !sub.invite_only;
|
sub.can_make_private = page_params.is_admin && !sub.invite_only;
|
||||||
sub.preview_url = narrow.by_stream_uri(sub.name);
|
sub.preview_url = narrow.by_stream_uri(sub.name);
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
|
{{#if should_display_subscription_button}}
|
||||||
<button class="button small rounded subscribe-button sub_unsub_button {{#unless subscribed }}unsubscribed{{/unless}}" type="button" name="button" title="{{t 'Toggle subscription'}} (S)">
|
<button class="button small rounded subscribe-button sub_unsub_button {{#unless subscribed }}unsubscribed{{/unless}}" type="button" name="button" title="{{t 'Toggle subscription'}} (S)">
|
||||||
{{#if subscribed }}{{#tr oneself }}Unsubscribe{{/tr}}{{else}}{{#tr oneself }}Subscribe{{/tr}}{{/if}}</button>
|
{{#if subscribed }}{{#tr oneself }}Unsubscribe{{/tr}}{{else}}{{#tr oneself }}Subscribe{{/tr}}{{/if}}</button>
|
||||||
|
{{/if}}
|
||||||
<a href="{{preview_url}}" class="button small rounded" id="preview-stream-button" role="button" title="{{t 'View stream'}} (V)">{{t "View stream"}}</a>
|
<a href="{{preview_url}}" class="button small rounded" id="preview-stream-button" role="button" title="{{t 'View stream'}} (V)">{{t "View stream"}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue