mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
upload: Return single elem for get_item(drag_drop_container) w/ edit.
Previously, opening multiple message_edits and then drag-dropping a
file into any one of them would cause all of them to upload ie you'd
get one uploaded file in each message_edit.
This bug was caused by returning multiple elements from
upload.get_item("drag_drop_container", config) when config.mode =
"edit".
This commit changes the selector to use the row provided (config.row),
and so ensures that the above bug doesn't happen.
This commit is contained in:
@@ -105,7 +105,7 @@ test("get_item", () => {
|
|||||||
assert.equal(upload.get_item("source", {mode: "edit", row: 123}), "message-edit-file-input");
|
assert.equal(upload.get_item("source", {mode: "edit", row: 123}), "message-edit-file-input");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
upload.get_item("drag_drop_container", {mode: "edit", row: 1}),
|
upload.get_item("drag_drop_container", {mode: "edit", row: 1}),
|
||||||
$(".message_edit_form"),
|
$(`#zfilt${CSS.escape(1)} .message_edit_form`),
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
upload.get_item("markdown_preview_hide_button", {mode: "edit", row: 65}),
|
upload.get_item("markdown_preview_hide_button", {mode: "edit", row: 65}),
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export function get_item(key, config) {
|
|||||||
case "source":
|
case "source":
|
||||||
return "message-edit-file-input";
|
return "message-edit-file-input";
|
||||||
case "drag_drop_container":
|
case "drag_drop_container":
|
||||||
return $(".message_edit_form");
|
return $(`#zfilt${CSS.escape(config.row)} .message_edit_form`);
|
||||||
case "markdown_preview_hide_button":
|
case "markdown_preview_hide_button":
|
||||||
return $(`#edit_form_${CSS.escape(config.row)} .undo_markdown_preview`);
|
return $(`#edit_form_${CSS.escape(config.row)} .undo_markdown_preview`);
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user