mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
js: Move current_msg_list, home_msg_list to ES6 module message_lists.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
fbf5ff26af
commit
d43ac7357a
@@ -13,6 +13,7 @@ import * as compose_ui from "./compose_ui";
|
||||
import * as drafts from "./drafts";
|
||||
import * as hash_util from "./hash_util";
|
||||
import {i18n} from "./i18n";
|
||||
import * as message_lists from "./message_lists";
|
||||
import * as message_viewport from "./message_viewport";
|
||||
import * as narrow_state from "./narrow_state";
|
||||
import * as notifications from "./notifications";
|
||||
@@ -145,12 +146,12 @@ export function complete_starting_tasks(msg_type, opts) {
|
||||
export function maybe_scroll_up_selected_message() {
|
||||
// If the compose box is obscuring the currently selected message,
|
||||
// scroll up until the message is no longer occluded.
|
||||
if (current_msg_list.selected_id() === -1) {
|
||||
if (message_lists.current.selected_id() === -1) {
|
||||
// If there's no selected message, there's no need to
|
||||
// scroll the compose box to avoid it.
|
||||
return;
|
||||
}
|
||||
const selected_row = current_msg_list.selected_row();
|
||||
const selected_row = message_lists.current.selected_row();
|
||||
|
||||
if (selected_row.height() > message_viewport.height() - 100) {
|
||||
// For very tall messages whose height is close to the entire
|
||||
@@ -298,7 +299,7 @@ export function respond_to_message(opts) {
|
||||
// in-progress composition, snapshot it.
|
||||
drafts.update_draft();
|
||||
|
||||
const message = current_msg_list.selected_message();
|
||||
const message = message_lists.current.selected_message();
|
||||
|
||||
if (message === undefined) {
|
||||
// empty narrow implementation
|
||||
@@ -332,7 +333,7 @@ export function respond_to_message(opts) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_msg_list.can_mark_messages_read()) {
|
||||
if (message_lists.current.can_mark_messages_read()) {
|
||||
unread_ops.notify_server_message_read(message);
|
||||
}
|
||||
|
||||
@@ -373,7 +374,7 @@ export function respond_to_message(opts) {
|
||||
|
||||
export function reply_with_mention(opts) {
|
||||
respond_to_message(opts);
|
||||
const message = current_msg_list.selected_message();
|
||||
const message = message_lists.current.selected_message();
|
||||
const mention = people.get_mention_syntax(message.sender_full_name, message.sender_id);
|
||||
compose_ui.insert_syntax_and_focus(mention);
|
||||
}
|
||||
@@ -425,8 +426,8 @@ export function on_topic_narrow() {
|
||||
|
||||
export function quote_and_reply(opts) {
|
||||
const textarea = $("#compose-textarea");
|
||||
const message_id = current_msg_list.selected_id();
|
||||
const message = current_msg_list.selected_message();
|
||||
const message_id = message_lists.current.selected_id();
|
||||
const message = message_lists.current.selected_message();
|
||||
|
||||
if (compose_state.has_message_content()) {
|
||||
// The user already started typing a message,
|
||||
|
||||
Reference in New Issue
Block a user