message_edit: Close message edit UI after message is moved.

Currently, if we navigate to some other topic/stream
while the message is being moved, the message edit UI
still remains open as we do not get its `row` in
`message_lists.current` since the message has not moved yet
to the stream/topic we navigated.

Hence the correct thing to do would be to delete
the message_id from `currently_editing_messages` if it
exists there but we cannot find the row.

Fixes #21724.
This commit is contained in:
jai2201
2022-08-10 02:53:32 +05:30
committed by Tim Abbott
parent 56b2b838ee
commit 1986b37a04
3 changed files with 14 additions and 9 deletions

View File

@@ -805,6 +805,17 @@ export function end_message_row_edit($row) {
$row.find("input.message_edit_topic").trigger("blur");
}
export function end_message_edit(message_id) {
const $row = message_lists.current.get_row(message_id);
if ($row.length > 0) {
end_message_row_edit($row);
} else if (currently_editing_messages.has(message_id)) {
// We should delete the message_id from currently_editing_messages
// if it exists there but we cannot find the row.
currently_editing_messages.delete(message_id);
}
}
export function save_inline_topic_edit($row) {
const msg_list = message_lists.current;
let message_id = rows.id_for_recipient_row($row);