From 76ec9cf60b75d8e71594e00f889f637d08000b11 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 13 Apr 2017 08:01:44 -0700 Subject: [PATCH] Fix bug with (un)subscribe button showing on wrong narrow. We had a bug for a while where if somebody subscribed you to a stream, and you were narrowed to another stream, we'd show a button in the "trailing bookend" to "Unsubscribe" from the current stream. I'm not sure how long we had that bug, but it was at least a couple months old, and I couldn't track down an issue for it. Now we make sure that the stream event for the subscription is related to the current narrow. Users should still see messages when they subscribe/unsubscribe themselves or when another user re-subscribes them to the stream that they are narrowed to. --- static/js/stream_events.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/stream_events.js b/static/js/stream_events.js index f4ae65d2c1..ae9d0f24a7 100644 --- a/static/js/stream_events.js +++ b/static/js/stream_events.js @@ -99,7 +99,7 @@ exports.mark_subscribed = function (sub, subscribers, color) { subs.update_settings_for_subscribed(sub); - if (current_msg_list.narrowed) { + if (narrow.is_for_stream_id(sub.stream_id)) { current_msg_list.update_trailing_bookend(); } @@ -124,7 +124,7 @@ exports.mark_unsubscribed = function (sub) { return; } - if (current_msg_list.narrowed) { + if (narrow.is_for_stream_id(sub.stream_id)) { current_msg_list.update_trailing_bookend(); }