hotkey: Fix wrong assumption of message_lists.current is defined.

Since we are checking `is_in_focus()` of recent and inbox view,
message_lists.current can be not defined here, also addition
a new view in Zulip will make this fail.
This commit is contained in:
Aman Agrawal
2025-10-09 16:25:04 +05:30
committed by Tim Abbott
parent c54dee9fab
commit 97452ea4f8

View File

@@ -1207,9 +1207,9 @@ function process_hotkey(e: JQuery.KeyDownEvent, hotkey: Hotkey): boolean {
if (inbox_ui.is_in_focus()) {
return inbox_ui.toggle_topic_visibility_policy();
}
if (message_lists.current!.selected_message()) {
if (message_lists.current?.selected_message()) {
user_topics_ui.toggle_topic_visibility_policy(
message_lists.current!.selected_message()!,
message_lists.current.selected_message()!,
);
return true;
}