mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
reactions: Fix implicit use of any.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
298b1aa1e6
commit
515eecd15c
@@ -1,5 +1,6 @@
|
|||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
import assert from "minimalistic-assert";
|
import assert from "minimalistic-assert";
|
||||||
|
import {z} from "zod";
|
||||||
|
|
||||||
import render_message_reaction from "../templates/message_reaction.hbs";
|
import render_message_reaction from "../templates/message_reaction.hbs";
|
||||||
|
|
||||||
@@ -110,9 +111,11 @@ function update_ui_and_send_reaction_ajax(
|
|||||||
error(xhr: JQuery.jqXHR) {
|
error(xhr: JQuery.jqXHR) {
|
||||||
waiting_for_server_request_ids.delete(reaction_request_id);
|
waiting_for_server_request_ids.delete(reaction_request_id);
|
||||||
if (xhr.readyState !== 0) {
|
if (xhr.readyState !== 0) {
|
||||||
|
const parsed = z.object({code: z.string()}).safeParse(xhr.responseJSON);
|
||||||
if (
|
if (
|
||||||
xhr.responseJSON?.code === "REACTION_ALREADY_EXISTS" ||
|
parsed.success &&
|
||||||
xhr.responseJSON?.code === "REACTION_DOES_NOT_EXIST"
|
(parsed.data.code === "REACTION_ALREADY_EXISTS" ||
|
||||||
|
parsed.data.code === "REACTION_DOES_NOT_EXIST")
|
||||||
) {
|
) {
|
||||||
// Don't send error report for simple precondition failures caused by race
|
// Don't send error report for simple precondition failures caused by race
|
||||||
// conditions; the user already got what they wanted
|
// conditions; the user already got what they wanted
|
||||||
|
|||||||
Reference in New Issue
Block a user