From e50cedfcb8f67a523b9560d56be8a71282f4ea62 Mon Sep 17 00:00:00 2001 From: YJDave Date: Sat, 10 Feb 2018 00:15:40 +0530 Subject: [PATCH] stream settings: Remove stream from subscribed list immediately on unsub. When user click on unsubscribe button, to unsubscribe from private stream immediately remove unsubscribed stream from all subscribed stream list. We don't remove public stream immediately on unsubscription, cause user may want to undo/subscribe back to stream. --- static/js/subs.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/static/js/subs.js b/static/js/subs.js index 6bfda1c90a..d33974445f 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -249,13 +249,21 @@ exports.update_settings_for_unsubscribed = function (sub) { var active_stream = exports.active_stream(); if (active_stream !== undefined && active_stream.id === sub.stream_id) { stream_edit.rerender_subscribers_list(sub); + + // If user unsubscribed from private stream then user can not subscribe to + // stream without invitation. So hide subscribe button. + if (!sub.should_display_subscription_button) { + settings_button.hide(); + } } - // If user unsubscribed from private stream then user can not subscribe to - // stream without invitation. So hide subscribe button. - if (!sub.should_display_subscription_button) { - settings_button.hide(); + // Remove private streams from subscribed streams list. + if ($("#subscriptions_table .search-container .tab-switcher .first").hasClass("selected") + && sub.invite_only) { + var sub_row = $('#subscriptions_table .stream-row[data-stream-id=' + sub.stream_id + ']'); + sub_row.addClass("notdisplayed"); } + row_for_stream_id(subs.stream_id).attr("data-temp-view", true); };