mirror of https://github.com/zulip/zulip.git
upload: Fix TypeScript noUncheckedIndexedAccess errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
e134ad1363
commit
6c0c19addb
|
@ -534,7 +534,7 @@ export function initialize(): void {
|
||||||
if (compose_state.composing()) {
|
if (compose_state.composing()) {
|
||||||
// Compose box is open; drop there.
|
// Compose box is open; drop there.
|
||||||
upload_files(compose_upload_object, compose_config, files);
|
upload_files(compose_upload_object, compose_config, files);
|
||||||
} else if ($last_drag_drop_edit_container.length !== 0) {
|
} else if ($last_drag_drop_edit_container[0] !== undefined) {
|
||||||
// A message edit box is open; drop there.
|
// A message edit box is open; drop there.
|
||||||
const row_id = rows.get_message_id($last_drag_drop_edit_container[0]);
|
const row_id = rows.get_message_id($last_drag_drop_edit_container[0]);
|
||||||
const $drag_drop_container = edit_config(row_id).drag_drop_container();
|
const $drag_drop_container = edit_config(row_id).drag_drop_container();
|
||||||
|
|
|
@ -754,7 +754,7 @@ test("main_file_drop_edit_mode", ({override, override_rewire}) => {
|
||||||
dropped_row_id = config.row;
|
dropped_row_id = config.row;
|
||||||
upload_files_called = true;
|
upload_files_called = true;
|
||||||
});
|
});
|
||||||
$(".message_edit_form form").last = () => ({length: 1});
|
$(".message_edit_form form").last = () => ({length: 1, [0]: "stub"});
|
||||||
override(rows, "get_message_id", () => 40);
|
override(rows, "get_message_id", () => 40);
|
||||||
|
|
||||||
// Edit box which registered the event handler no longer exists.
|
// Edit box which registered the event handler no longer exists.
|
||||||
|
@ -776,7 +776,7 @@ test("main_file_drop_edit_mode", ({override, override_rewire}) => {
|
||||||
|
|
||||||
override(rows, "get_message_id", () => 40);
|
override(rows, "get_message_id", () => 40);
|
||||||
// Edit box open
|
// Edit box open
|
||||||
$(".message_edit_form form").last = () => ({length: 1});
|
$(".message_edit_form form").last = () => ({length: 1, [0]: "stub"});
|
||||||
drop_handler(drop_event);
|
drop_handler(drop_event);
|
||||||
assert.equal(upload_files_called, true);
|
assert.equal(upload_files_called, true);
|
||||||
assert.equal(dropped_row_id, 40);
|
assert.equal(dropped_row_id, 40);
|
||||||
|
|
Loading…
Reference in New Issue