mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
stream settings: Don't show never subscribed private stream's preview-link.
For public stream, always show stream preview link. For private stream, only show stream preview link if user is currently subscribed or previously subscribed to private stream.
This commit is contained in:
@@ -487,10 +487,11 @@ exports.get_streams_for_admin = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.initialize_from_page_params = function () {
|
exports.initialize_from_page_params = function () {
|
||||||
function populate_subscriptions(subs, subscribed) {
|
function populate_subscriptions(subs, subscribed, previously_subscribed) {
|
||||||
subs.forEach(function (sub) {
|
subs.forEach(function (sub) {
|
||||||
var stream_name = sub.name;
|
var stream_name = sub.name;
|
||||||
sub.subscribed = subscribed;
|
sub.subscribed = subscribed;
|
||||||
|
sub.previously_subscribed = previously_subscribed;
|
||||||
|
|
||||||
exports.create_sub_from_server_data(stream_name, sub);
|
exports.create_sub_from_server_data(stream_name, sub);
|
||||||
});
|
});
|
||||||
@@ -498,9 +499,9 @@ exports.initialize_from_page_params = function () {
|
|||||||
|
|
||||||
exports.set_realm_default_streams(page_params.realm_default_streams);
|
exports.set_realm_default_streams(page_params.realm_default_streams);
|
||||||
|
|
||||||
populate_subscriptions(page_params.subscriptions, true);
|
populate_subscriptions(page_params.subscriptions, true, true);
|
||||||
populate_subscriptions(page_params.unsubscribed, false);
|
populate_subscriptions(page_params.unsubscribed, false, true);
|
||||||
populate_subscriptions(page_params.never_subscribed, false);
|
populate_subscriptions(page_params.never_subscribed, false, false);
|
||||||
|
|
||||||
// Migrate the notifications stream from the new API structure to
|
// Migrate the notifications stream from the new API structure to
|
||||||
// what the frontend expects.
|
// what the frontend expects.
|
||||||
|
|||||||
@@ -25,7 +25,17 @@
|
|||||||
<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}}
|
{{/if}}
|
||||||
|
{{#if invite_only}}
|
||||||
|
{{#if subscribed}}
|
||||||
<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>
|
||||||
|
{{else}}
|
||||||
|
{{#if previously_subscribed}}
|
||||||
|
<a href="{{preview_url}}" class="button small rounded" id="preview-stream-button" role="button" title="{{t 'View stream'}} (V)">{{t "View stream"}}</a>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
<a href="{{preview_url}}" class="button small rounded" id="preview-stream-button" role="button" title="{{t 'View stream'}} (V)">{{t "View stream"}}</a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stream-description">
|
<div class="stream-description">
|
||||||
|
|||||||
Reference in New Issue
Block a user