mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
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:
@@ -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();
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user