Skip to content

Commit

Permalink
Bugfix: Use simple logic to calculate isByMe (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoonBaek authored Sep 30, 2021
1 parent b67ae35 commit fd01989
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/ui/MessageContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ import {
isTextMessage,
isOGMessage,
isThumbnailMessage,
isMessageSentByMe,
getOutgoingMessageState,
getSenderName,
getMessageCreatedAt,
isSentMessage,
isPendingMessage,
} from '../../utils';
import { UserProfileContext } from '../../lib/UserProfileContext';

Expand Down Expand Up @@ -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' : '';
Expand Down

0 comments on commit fd01989

Please sign in to comment.