pm_list: Cut import of topic_zoom.

topic_zoom.is_zoomed_in() can’t be true in pm_list.zoom_in, because
“more conversations” would not be visible in that state.  And it can’t
be true when pm_list.handle_narrow_activated calls pm_list.expand,
because “more topics” would not be visible in an all-DM view.  So the
only non-inert call is via click_handlers; move it there.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-06 18:00:10 -07:00 committed by Tim Abbott
parent 564e91f3a8
commit a43ea3efaa
2 changed files with 5 additions and 9 deletions

View File

@ -41,6 +41,7 @@ import * as starred_messages_ui from "./starred_messages_ui";
import * as stream_list from "./stream_list";
import * as stream_popover from "./stream_popover";
import * as topic_list from "./topic_list";
import * as topic_zoom from "./topic_zoom";
import * as ui_util from "./ui_util";
import {parse_html} from "./ui_util";
import * as user_topics from "./user_topics";
@ -729,6 +730,10 @@ export function initialize() {
);
const scroll_position = $left_sidebar_scrollbar.scrollTop();
if (topic_zoom.is_zoomed_in()) {
topic_zoom.zoom_out();
}
// This next bit of logic is a bit subtle; this header
// button scrolls to the top of the direct messages
// section is uncollapsed but out of view; otherwise, we

View File

@ -5,7 +5,6 @@ import * as pm_list_data from "./pm_list_data";
import * as pm_list_dom from "./pm_list_dom";
import * as resize from "./resize";
import * as scroll_util from "./scroll_util";
import * as topic_zoom from "./topic_zoom";
import * as ui_util from "./ui_util";
import * as vdom from "./vdom";
@ -100,11 +99,6 @@ export function update_private_messages() {
}
export function expand() {
// Only one thing can be zoomed at a time.
if (topic_zoom.is_zoomed_in()) {
topic_zoom.zoom_out();
}
private_messages_collapsed = false;
$("#toggle_private_messages_section_icon").addClass("fa-caret-down");
@ -193,9 +187,6 @@ export function toggle_private_messages_section() {
function zoom_in() {
zoomed = true;
if (topic_zoom.is_zoomed_in()) {
topic_zoom.zoom_out();
}
update_private_messages();
$(".private_messages_container").removeClass("zoom-out").addClass("zoom-in");
$("#streams_list").hide();