mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
minor: Rename previously_selected of message selected event.
This is done since we have logic in place which compares `event.id` and `event.previously_selected`, both of which point to message ids.
This commit is contained in:
@@ -146,7 +146,7 @@ class MessageList {
|
||||
...opts,
|
||||
id,
|
||||
msg_list: this,
|
||||
previously_selected: this.data.selected_id(),
|
||||
previously_selected_id: this.data.selected_id(),
|
||||
};
|
||||
|
||||
const convert_id = (str_id) => {
|
||||
|
||||
@@ -170,13 +170,13 @@ exports.initialize = function () {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.mark_read && event.previously_selected !== -1) {
|
||||
if (event.mark_read && event.previously_selected_id !== -1) {
|
||||
// Mark messages between old pointer and new pointer as read
|
||||
let messages;
|
||||
if (event.id < event.previously_selected) {
|
||||
messages = event.msg_list.message_range(event.id, event.previously_selected);
|
||||
if (event.id < event.previously_selected_id) {
|
||||
messages = event.msg_list.message_range(event.id, event.previously_selected_id);
|
||||
} else {
|
||||
messages = event.msg_list.message_range(event.previously_selected, event.id);
|
||||
messages = event.msg_list.message_range(event.previously_selected_id, event.id);
|
||||
}
|
||||
if (event.msg_list.can_mark_messages_read()) {
|
||||
unread_ops.notify_server_messages_read(messages, {from: "pointer"});
|
||||
|
||||
@@ -224,7 +224,7 @@ exports.initialize_kitchen_sink_stuff = function () {
|
||||
const row_from_dom = current_msg_list.get_row(event.id);
|
||||
const messages = event.msg_list.all_messages();
|
||||
blueslip.debug("message_selected missing selected row", {
|
||||
previously_selected: event.previously_selected,
|
||||
previously_selected_id: event.previously_selected_id,
|
||||
selected_id: event.id,
|
||||
selected_idx: event.msg_list.selected_idx(),
|
||||
selected_idx_exact: messages.indexOf(event.msg_list.get(event.id)),
|
||||
@@ -246,7 +246,7 @@ exports.initialize_kitchen_sink_stuff = function () {
|
||||
// just place it in the very center
|
||||
message_viewport.recenter_view(row, {
|
||||
from_scroll: event.from_scroll,
|
||||
force_center: event.previously_selected === -1,
|
||||
force_center: event.previously_selected_id === -1,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user