Streamline closing topic lists.

If our topic list isn't zoomed in, avoid calling
stream_list.zoom_out_topics().

This commit also introduces `zoomed_in` to track
our topic zooming state.
This commit is contained in:
Steve Howell
2018-09-10 21:26:12 +00:00
committed by Tim Abbott
parent 047a81dd2c
commit 4bfb49c3a4
2 changed files with 12 additions and 7 deletions

View File

@@ -707,16 +707,10 @@ run_test('stream_list', () => {
const sidebar_helper = make_sidebar_helper();
const topic_list_helper = make_topic_list_helper();
var streams_shown;
stream_list.zoom_out_topics = () => {
streams_shown = true;
};
// This is what we are testing!
stream_list.update_streams_sidebar();
assert(streams_shown);
jquery_helper.verify_actions();
sidebar_helper.verify_actions();
topic_list_helper.verify_actions();

View File

@@ -2,6 +2,8 @@ var topic_zoom = (function () {
var exports = {};
var zoomed_in = false;
function zoom_in() {
var stream_id = topic_list.active_stream_id();
@@ -10,6 +12,8 @@ function zoom_in() {
stream_list.zoom_in_topics({
stream_id: stream_id,
});
zoomed_in = true;
}
function zoom_out() {
@@ -22,11 +26,18 @@ function zoom_out() {
if (stream_li) {
stream_list.scroll_stream_into_view(stream_li);
}
zoomed_in = false;
}
exports.clear_topics = function () {
topic_list.close();
stream_list.zoom_out_topics();
if (zoomed_in) {
stream_list.zoom_out_topics();
}
zoomed_in = false;
};
exports.initialize = function () {