left_sidebar: Fix 'more topics' view scroll position.

This is a preparatory work for #24360.

'DIRECT MESSAGES' are completely collapsed in the 'more topics' view.

Clicking on 'DIRECT MESSAGES' exits the 'more topics' view and
scrolls to it from that state. One wouldn't be able to open
'DIRECT MESSAGES' without leaving the 'more topics' view.

Fixes: #25035.

Signed-off-by: Ishaan Singh <asishaan.191cs124@nitk.edu.in>
This commit is contained in:
Ishaan Singh 2023-04-08 19:11:19 +05:30 committed by Tim Abbott
parent 2700ad7903
commit 96b051bec4
2 changed files with 9 additions and 1 deletions

View File

@ -31,7 +31,7 @@ export function set_count(count) {
ui_util.update_unread_count_in_dom(get_private_messages_section_header(), count); ui_util.update_unread_count_in_dom(get_private_messages_section_header(), count);
} }
function close() { export function close() {
private_messages_collapsed = true; private_messages_collapsed = true;
$("#toggle_private_messages_section_icon").removeClass("fa-caret-down"); $("#toggle_private_messages_section_icon").removeClass("fa-caret-down");
$("#toggle_private_messages_section_icon").addClass("fa-caret-right"); $("#toggle_private_messages_section_icon").addClass("fa-caret-right");
@ -100,7 +100,13 @@ export function update_private_messages() {
} }
export function expand() { 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; private_messages_collapsed = false;
$("#toggle_private_messages_section_icon").addClass("fa-caret-down"); $("#toggle_private_messages_section_icon").addClass("fa-caret-down");
$("#toggle_private_messages_section_icon").removeClass("fa-caret-right"); $("#toggle_private_messages_section_icon").removeClass("fa-caret-right");
update_private_messages(); update_private_messages();

View File

@ -1,5 +1,6 @@
import $ from "jquery"; import $ from "jquery";
import * as pm_list from "./pm_list";
import * as popovers from "./popovers"; import * as popovers from "./popovers";
import * as stream_list from "./stream_list"; import * as stream_list from "./stream_list";
import * as topic_list from "./topic_list"; import * as topic_list from "./topic_list";
@ -15,6 +16,7 @@ function zoom_in() {
const stream_id = topic_list.active_stream_id(); const stream_id = topic_list.active_stream_id();
popovers.hide_all_except_sidebars(); popovers.hide_all_except_sidebars();
pm_list.close();
topic_list.zoom_in(); topic_list.zoom_in();
stream_list.zoom_in_topics({ stream_list.zoom_in_topics({
stream_id, stream_id,