Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
reactions: Do not send server error reports for duplicate requests.
Alex Vandiverd05a9d400060
diff --git a/web/src/reactions.js b/web/src/reactions.jsindex a6d26379474..e3402949e43 100644--- a/web/src/reactions.js+++ b/web/src/reactions.js@@ -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));+ }},};diff --git a/web/tests/reactions.test.js b/web/tests/reactions.test.jsindex 09ccfbe6ac8..1ebc54ae22b 100644--- a/web/tests/reactions.test.js+++ b/web/tests/reactions.test.js@@ -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{