diff --git a/src/app/services/handlers.ts b/src/app/services/handlers.ts index 9f67fdf5..8b19a323 100644 --- a/src/app/services/handlers.ts +++ b/src/app/services/handlers.ts @@ -2,7 +2,7 @@ import toast from "react-hot-toast"; import { batch } from "react-redux"; import { ContentTypes } from "../config"; -import { addMessage, removeMessage, updateMessage } from "../slices/message"; +import { addMessage, removeMessage } from "../slices/message"; import { addChannelMsg, removeChannelMsg } from "../slices/message.channel"; import { addUserMsg, removeUserMsg } from "../slices/message.user"; @@ -19,12 +19,12 @@ export const onMessageSendStarted = async ( { dispatch, queryFulfilled }, from = "channel" ) => { - // 忽略archive类型的消息 + // 忽略 archive 类型的消息 if (type == "archive") return; // id: who send to ,from_uid: who sent // console.log("handlers data", content, type, properties, ignoreLocal, id); const isMedia = properties.content_type - ? ["image", "video", "audio"].includes(properties.content_type.split("/")[0]) + ? ["image", "video", "audio"].includes(properties.content_type.toLowerCase().split("/")[0]) : false; // const isImage = properties.content_type?.startsWith("image"); const ts = properties.local_id || +new Date(); diff --git a/src/utils.tsx b/src/utils.tsx index 79d095f6..edd9afae 100644 --- a/src/utils.tsx +++ b/src/utils.tsx @@ -69,8 +69,9 @@ export const getLocalAuthData = () => { }; }; export const isImage = (file_type = "", size = 0) => { + const _fileType = file_type.toLowerCase(); return ( - file_type.startsWith("image") && file_type !== "image/x-sony-arw" && size <= FILE_IMAGE_SIZE + _fileType.startsWith("image") && _fileType !== "image/x-sony-arw" && size <= FILE_IMAGE_SIZE ); };