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.
This commit is contained in:
clarammdantas 2020-05-11 17:23:14 -03:00 committed by Tim Abbott
parent 779daa5374
commit 77195f94c1

View File

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