mirror of https://github.com/zulip/zulip.git
topic lists: Refactor zoom-out logic for un-narrows.
For cases where we are zoomed in to a stream and then go to a different narrow (Home, PMs, etc.), we now let topic_list.zoom_out orchestrate the removal of the topic list instead of stream_list.zoom_out. This will help us when we move to a world where topic_list redraws topic lists on zoom-in/zoom-out, because we won't waste effort rebuilding lists that are about to be removed.
This commit is contained in:
parent
bfc6f57195
commit
3b7430ba82
|
@ -178,9 +178,9 @@ function zoom_in() {
|
|||
});
|
||||
}
|
||||
|
||||
function zoom_out() {
|
||||
function zoom_out(options) {
|
||||
popovers.hide_all();
|
||||
topic_list.zoom_out();
|
||||
topic_list.zoom_out(options);
|
||||
|
||||
// Show stream list titles and pinned stream splitter
|
||||
$(".stream-filters-label").each(function () {
|
||||
|
@ -202,12 +202,13 @@ function remove_expanded_private_messages() {
|
|||
|
||||
function reset_to_unnarrowed(narrowed_within_same_stream) {
|
||||
if (topic_list.is_zoomed() && narrowed_within_same_stream !== true) {
|
||||
zoom_out();
|
||||
zoom_out({clear_topics: true});
|
||||
} else {
|
||||
topic_list.remove_expanded_topics();
|
||||
}
|
||||
|
||||
private_messages_open = false;
|
||||
$("ul.filters li").removeClass('active-filter active-sub-filter');
|
||||
topic_list.remove_expanded_topics();
|
||||
remove_expanded_private_messages();
|
||||
}
|
||||
|
||||
|
|
|
@ -151,8 +151,11 @@ exports.zoom_in = function () {
|
|||
zoomed = true;
|
||||
};
|
||||
|
||||
exports.zoom_out = function () {
|
||||
exports.zoom_out = function (options) {
|
||||
zoomed = false;
|
||||
if (options && options.clear_topics) {
|
||||
exports.remove_expanded_topics();
|
||||
}
|
||||
};
|
||||
|
||||
exports.is_zoomed = function () {
|
||||
|
@ -168,7 +171,7 @@ exports.set_click_handlers = function (callbacks) {
|
|||
});
|
||||
|
||||
$('.show-all-streams').on('click', function (e) {
|
||||
callbacks.zoom_out();
|
||||
callbacks.zoom_out({clear_topics: false});
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
|
Loading…
Reference in New Issue