fix(chat): cleanup of moderator flag check

This commit is contained in:
Gabe Kangas
2023-05-31 16:54:30 -07:00
parent 34a3b214ea
commit 6d30de19f6

View File

@@ -82,7 +82,6 @@ function checkIsModerator(message: ChatMessage | ConnectedClientInfoEvent) {
const { user } = message; const { user } = message;
const u = new User(user); const u = new User(user);
return u.isModerator; return u.isModerator;
} }
@@ -155,6 +154,8 @@ export const ChatContainer: FC<ChatContainerProps> = ({
collapsedMessageIds.add(message.id); collapsedMessageIds.add(message.id);
} }
const isAuthorModerator = checkIsModerator(message);
return ( return (
<ChatUserMessage <ChatUserMessage
message={message} message={message}
@@ -162,7 +163,7 @@ export const ChatContainer: FC<ChatContainerProps> = ({
highlightString={usernameToHighlight} // What to highlight in the message highlightString={usernameToHighlight} // What to highlight in the message
sentBySelf={message.user?.id === chatUserId} // The local user sent this message sentBySelf={message.user?.id === chatUserId} // The local user sent this message
sameUserAsLast={collapsed} sameUserAsLast={collapsed}
isAuthorModerator={message.user?.isModerator} isAuthorModerator={isAuthorModerator}
isAuthorBot={message.user?.isBot} isAuthorBot={message.user?.isBot}
isAuthorAuthenticated={message.user?.authenticated} isAuthorAuthenticated={message.user?.authenticated}
key={message.id} key={message.id}