From fd01989d6432df290cf60e249a23f3f9bd3606b8 Mon Sep 17 00:00:00 2001 From: HoonBaek Date: Thu, 30 Sep 2021 10:52:05 +0900 Subject: [PATCH] Bugfix: Use simple logic to calculate isByMe (#23) --- src/ui/MessageContent/index.tsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ui/MessageContent/index.tsx b/src/ui/MessageContent/index.tsx index c9cb381a1..2a091a895 100644 --- a/src/ui/MessageContent/index.tsx +++ b/src/ui/MessageContent/index.tsx @@ -25,12 +25,9 @@ import { isTextMessage, isOGMessage, isThumbnailMessage, - isMessageSentByMe, getOutgoingMessageState, getSenderName, getMessageCreatedAt, - isSentMessage, - isPendingMessage, } from '../../utils'; import { UserProfileContext } from '../../lib/UserProfileContext'; @@ -79,10 +76,9 @@ export default function MessageContent({ const [mouseHover, setMouseHover] = useState(false); const [supposedHover, setSupposedHover] = useState(false); - const isByMe: boolean = isPendingMessage(channel, message as UserMessage | FileMessage) - || isSentMessage(channel, message as UserMessage | FileMessage) - || isMessageSentByMe(userId, message as UserMessage | FileMessage); - + const isByMe = (userId === (message as UserMessage | FileMessage)?.sender?.userId) + || ((message as UserMessage | FileMessage).sendingStatus === 'pending') + || ((message as UserMessage | FileMessage).sendingStatus === 'failed'); const isByMeClassName = isByMe ? 'outgoing' : 'incoming'; const chainTopClassName = chainTop ? 'chain-top' : ''; const useReactionClassName = useReaction ? 'use-reactions' : '';