Use narrow.stream() instead of stream_list.active_stream_name().

We no longer use active_stream_name(), which was mostly a
duplicate of narrow.stream().  For nonsensical queries like
"stream:foo stream:bar" the behavior may change slightly here.

We know that we don't handle non-sensical queries particularly
well, but at least if we always go through narrow.stream(),
the behavior will be consistent.

I did test this with some sensible compound narrows, like searching
for a keyword within a stream.
This commit is contained in:
Steve Howell
2016-11-10 09:49:36 -08:00
committed by Tim Abbott
parent dc8463e09c
commit e76422b946

View File

@@ -10,16 +10,6 @@ var last_mention_count = 0;
var previous_sort_order;
var previous_unpinned_order;
function active_stream_name() {
if (narrow.active()) {
var op_streams = narrow.filter().operands('stream');
if (op_streams) {
return op_streams[0];
}
}
return false;
}
function filter_streams_by_search(streams) {
var search_box = $(".stream-list-filter");
@@ -168,7 +158,7 @@ function zoom_in() {
popovers.hide_all();
zoomed_to_topics = true;
$("#streams_list").expectOne().removeClass("zoom-out").addClass("zoom-in");
zoomed_stream = active_stream_name();
zoomed_stream = narrow.stream();
// Hide stream list titles and pinned stream splitter
$(".stream-filters-label").each(function () {
@@ -547,7 +537,7 @@ $(function () {
});
$(document).on('narrow_activated.zulip', function (event) {
reset_to_unnarrowed(active_stream_name() === zoomed_stream);
reset_to_unnarrowed(narrow.stream() === zoomed_stream);
// TODO: handle confused filters like "in:all stream:foo"
var op_in = event.filter.operands('in');