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.
This commit is contained in:
YJDave 2018-02-10 00:15:40 +05:30 committed by Tim Abbott
parent 32407b4dc0
commit e50cedfcb8

View File

@ -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);
};