mirror of https://github.com/zulip/zulip.git
message_edit: Move get_upload_object_from_row to upload module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
fb19476c4e
commit
549bae5176
|
@ -45,8 +45,6 @@ const currently_editing_messages = new Map();
|
|||
let currently_deleting_messages = [];
|
||||
let currently_topic_editing_messages = [];
|
||||
const currently_echoing_messages = new Map();
|
||||
const upload_objects_by_row = new Map();
|
||||
|
||||
// These variables are designed to preserve the user's most recent
|
||||
// choices when editing a group of messages, to make it convenient to
|
||||
// move several topics in a row with the same settings.
|
||||
|
@ -568,7 +566,7 @@ function start_edit_with_content($row, content, edit_box_open_callback) {
|
|||
mode: "edit",
|
||||
row: row_id,
|
||||
});
|
||||
upload_objects_by_row.set(row_id, upload_object);
|
||||
upload.upload_objects_by_message_edit_row.set(row_id, upload_object);
|
||||
}
|
||||
|
||||
export function start($row, edit_box_open_callback) {
|
||||
|
@ -778,18 +776,14 @@ export function end_inline_topic_edit($row) {
|
|||
message_lists.current.hide_edit_topic_on_recipient_row($row);
|
||||
}
|
||||
|
||||
export function get_upload_object_from_row(row_id) {
|
||||
return upload_objects_by_row.get(row_id);
|
||||
}
|
||||
|
||||
function remove_uploads_from_row(row_id) {
|
||||
const uploads_for_row = upload_objects_by_row.get(row_id);
|
||||
const uploads_for_row = upload.upload_objects_by_message_edit_row.get(row_id);
|
||||
// We need to cancel all uploads, reset their progress,
|
||||
// and clear the files upon ending the edit.
|
||||
uploads_for_row?.cancelAll();
|
||||
// Since we removed all the uploads from the row, we should
|
||||
// now remove the corresponding upload object from the store.
|
||||
upload_objects_by_row.delete(row_id);
|
||||
upload.upload_objects_by_message_edit_row.delete(row_id);
|
||||
}
|
||||
|
||||
export function end_message_row_edit($row) {
|
||||
|
|
|
@ -10,12 +10,12 @@ import * as compose_state from "./compose_state";
|
|||
import * as compose_ui from "./compose_ui";
|
||||
import {csrf_token} from "./csrf";
|
||||
import {$t} from "./i18n";
|
||||
import * as message_edit from "./message_edit";
|
||||
import * as message_lists from "./message_lists";
|
||||
import {page_params} from "./page_params";
|
||||
import * as rows from "./rows";
|
||||
|
||||
export let compose_upload_object;
|
||||
export const upload_objects_by_message_edit_row = new Map();
|
||||
|
||||
// Show the upload button only if the browser supports it.
|
||||
export function feature_check($upload_button) {
|
||||
|
@ -454,7 +454,7 @@ export function initialize() {
|
|||
if (!$drag_drop_container.closest("html").length) {
|
||||
return;
|
||||
}
|
||||
const edit_upload_object = message_edit.get_upload_object_from_row(row_id);
|
||||
const edit_upload_object = upload_objects_by_message_edit_row.get(row_id);
|
||||
|
||||
upload_files(edit_upload_object, {mode: "edit", row: row_id}, files);
|
||||
} else if (message_lists.current.selected_message()) {
|
||||
|
|
Loading…
Reference in New Issue