From 77195f94c1f6ebff49d3cd8db2dbc4edcc68bb40 Mon Sep 17 00:00:00 2001 From: clarammdantas Date: Mon, 11 May 2020 17:23:14 -0300 Subject: [PATCH] stream_settings: Don't remove stream_row if in "All Streams" tab. If you were on "All Streams" tab and unsubscribed to a private stream, that stream row would momentarily disappear. If you click again on "All Streams" button, it would appear again. The problem was that the selector was finding two elements instead of just the tab element. To solve this we used a more specific selector to make sure we are getting the Subscribed tab only. --- static/js/subs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/js/subs.js b/static/js/subs.js index 7fc33cf7d5..2ac96671cf 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -107,7 +107,9 @@ exports.toggle_pin_to_top_stream = function (sub) { exports.is_subscribed_stream_tab_active = function () { // Returns true if "Subscribed" tab in stream settings is open // otherwise false. - if ($("#subscriptions_table .search-container .tab-switcher .first").hasClass("selected")) { + const tab = $(`#subscriptions_table .search-container .tab-switcher + .first[data-tab-key=subscribed]`).expectOne(); + if (tab.hasClass("selected")) { return true; } return false;