Fix "All messages" showing when it shouldn't

I haven't filed an issue about this since I just quickly found and
tracked down the bug, but the STR were:

1. Subscribe to stream foo
2. Hide foo from your home view
3. Unsubscribe from stream foo
4. Unhide other subscribed streams you've hidden from home view, if any

The "All messages" link would stay, although it should go away in this
case. The apparent cause was an incorrect assumption (when implementing
this feature) that the stream_info dict only contains subscribed
streams; in fact, we also populate it with streams you used to subscribe
to.

(imported from commit 67f95c8c8a211a4943a2de394919d15a0d5435d0)
This commit is contained in:
Scott Feeney 2013-08-13 14:41:06 -04:00
parent 550fd6281c
commit 0241ae4136
1 changed files with 2 additions and 1 deletions

View File

@ -42,7 +42,8 @@ exports.update_all_messages_link = function () {
// the user has any subscriptions hidden from home view. // the user has any subscriptions hidden from home view.
var all_messages = $("#global_filters [data-name='all']")[0]; var all_messages = $("#global_filters [data-name='all']")[0];
if (_.every(stream_info.values(), function (sub) { return sub.in_home_view; })) { if (_.every(_.where(stream_info.values(), {subscribed: true}),
function (sub) { return sub.in_home_view; })) {
$(all_messages).addClass('hidden-filter'); $(all_messages).addClass('hidden-filter');
} else { } else {
$(all_messages).removeClass('hidden-filter'); $(all_messages).removeClass('hidden-filter');