mirror of https://github.com/zulip/zulip.git
reactions: Do not send server error reports for duplicate requests.
This commit is contained in:
parent
871a668dd2
commit
d05a9d4000
|
@ -85,8 +85,15 @@ function update_ui_and_send_reaction_ajax(message_id, reaction_info) {
|
|||
},
|
||||
error(xhr) {
|
||||
view.waiting_for_server_request_ids.delete(reaction_request_id);
|
||||
const response = channel.xhr_error_message("Error sending reaction", xhr);
|
||||
blueslip.error(response);
|
||||
if (
|
||||
xhr.responseJSON?.code === "REACTION_ALREADY_EXISTS" ||
|
||||
xhr.responseJSON?.code === "REACTION_DOES_NOT_EXIST"
|
||||
) {
|
||||
// Don't send error report for simple precondition failures caused by race
|
||||
// conditions; the user already got what they wanted
|
||||
} else {
|
||||
blueslip.error(channel.xhr_error_message("Error sending reaction", xhr));
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ test("sending", ({override, override_rewire}) => {
|
|||
// Since this path calls blueslip.warn, we need to handle it.
|
||||
blueslip.expect("error", "XHR error message.");
|
||||
channel.xhr_error_message = () => "XHR error message.";
|
||||
args.error();
|
||||
args.error({responseJSON: {msg: "Some error message"}});
|
||||
}
|
||||
emoji_name = "alien"; // not set yet
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue