From 55325b71a440f988f263c334018bb041e9b6d748 Mon Sep 17 00:00:00 2001 From: Yashashvi Dave Date: Tue, 7 Aug 2018 19:11:00 +0530 Subject: [PATCH] stream settings: Display nothing-selected when active-stream is deleted. Display nothing-selected in stream settings tab, if we get delete-stream event of active-stream(which stream's settings tab is opened) in frontend. --- static/js/server_events_dispatch.js | 2 +- static/js/stream_edit.js | 2 -- static/js/subs.js | 4 ++++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js index d50ca0a11b..d74d3a1083 100644 --- a/static/js/server_events_dispatch.js +++ b/static/js/server_events_dispatch.js @@ -237,8 +237,8 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) { } else if (event.op === 'delete') { _.each(event.streams, function (stream) { var was_subscribed = stream_data.get_sub_by_id(stream.stream_id).subscribed; - stream_data.delete_sub(stream.stream_id); subs.remove_stream(stream.stream_id); + stream_data.delete_sub(stream.stream_id); if (was_subscribed) { stream_list.remove_sidebar_row(stream.stream_id); } diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js index b4d9891012..68f2db38db 100644 --- a/static/js/stream_edit.js +++ b/static/js/stream_edit.js @@ -668,8 +668,6 @@ exports.initialize = function () { } var row = $(".stream-row.active"); exports.delete_stream(stream_id, $(".stream_change_property_info"), row); - $(".settings").hide(); - $(".nothing-selected").show(); }); $("#subscriptions_table").on("hide.bs.modal", "#deactivation_stream_modal", function () { diff --git a/static/js/subs.js b/static/js/subs.js index f5cc461141..50d5a45e4d 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -250,6 +250,10 @@ exports.remove_stream = function (stream_id) { // stream, but we let jQuery silently handle that. var row = row_for_stream_id(stream_id); row.remove(); + var sub = stream_data.get_sub_by_id(stream_id); + if (stream_edit.is_sub_settings_active(sub)) { + exports.show_subs_pane.nothing_selected(); + } }; exports.update_settings_for_subscribed = function (sub) {