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:
YJDave
2018-02-06 14:12:41 +05:30
committed by Tim Abbott
parent 54e56481e6
commit c1f9b04435
2 changed files with 16 additions and 5 deletions

View File

@@ -487,10 +487,11 @@ exports.get_streams_for_admin = function () {
};
exports.initialize_from_page_params = function () {
function populate_subscriptions(subs, subscribed) {
function populate_subscriptions(subs, subscribed, previously_subscribed) {
subs.forEach(function (sub) {
var stream_name = sub.name;
sub.subscribed = subscribed;
sub.previously_subscribed = previously_subscribed;
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);
populate_subscriptions(page_params.subscriptions, true);
populate_subscriptions(page_params.unsubscribed, false);
populate_subscriptions(page_params.never_subscribed, false);
populate_subscriptions(page_params.subscriptions, true, true);
populate_subscriptions(page_params.unsubscribed, false, true);
populate_subscriptions(page_params.never_subscribed, false, false);
// Migrate the notifications stream from the new API structure to
// what the frontend expects.