mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 12:33:40 +00:00
message edit: Use a default error message for failed edits.
Bug reported here:
https://chat.zulip.org/#narrow/stream/464-kandra-js-errors/topic/Error.3A.20The.20partial.20.40partial-block.20could.20not.20be.20found/near/1673466
The reported issue was for a message edit request, and it was
happening because `channel.xhr_error_message` can return the
empty string sometimes, and `render_compose_banner` shows the
banner text if it exists and otherwise tries to render a
`@partial-block`. Unfortunately the empty string acts as falsy
in the template, leading to the partial block error.
This commit adds a default error message that was removed
in 96680e95fb.
It also adds a check to not show an error banner at all if
`readyState` is 0, which means the request was cancelled.
This commit is contained in:
@@ -1069,15 +1069,20 @@ export function save_message_row_edit($row) {
|
||||
}
|
||||
|
||||
hide_message_edit_spinner($row);
|
||||
const message = channel.xhr_error_message("", xhr);
|
||||
const $container = compose_banner.get_compose_banner_container(
|
||||
$row.find("textarea"),
|
||||
);
|
||||
compose_banner.show_error_message(
|
||||
message,
|
||||
compose_banner.CLASSNAMES.generic_compose_error,
|
||||
$container,
|
||||
);
|
||||
if (xhr.readyState !== 0) {
|
||||
const message = channel.xhr_error_message(
|
||||
$t({defaultMessage: "Error editing message"}),
|
||||
xhr,
|
||||
);
|
||||
const $container = compose_banner.get_compose_banner_container(
|
||||
$row.find("textarea"),
|
||||
);
|
||||
compose_banner.show_error_message(
|
||||
message,
|
||||
compose_banner.CLASSNAMES.generic_compose_error,
|
||||
$container,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user