From c3f9f246247851035cf8350a5119666e6b307f8d Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sat, 11 Dec 2021 16:03:24 -0800 Subject: [PATCH] Fix moderator shield showing incorrectly. It was being shown for all messages if you're a moderator, instead of just being shown on messages from moderators. --- webroot/js/components/chat/chat-message-view.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/webroot/js/components/chat/chat-message-view.js b/webroot/js/components/chat/chat-message-view.js index acad4192b..38585a5fb 100644 --- a/webroot/js/components/chat/chat-message-view.js +++ b/webroot/js/components/chat/chat-message-view.js @@ -7,7 +7,7 @@ import { messageBubbleColorForHue, textColorForHue, } from '../../utils/user-colors.js'; -import { convertToText } from '../../utils/chat.js'; +import { convertToText, checkIsModerator } from '../../utils/chat.js'; import { SOCKET_MESSAGE_TYPES } from '../../utils/websocket.js'; import { getDiffInDaysFromNow } from '../../utils/helpers.js'; import ModeratorActions from './moderator-actions.js'; @@ -42,12 +42,8 @@ export default class ChatMessageView extends Component { render() { const { message, isModerator, accessToken } = this.props; const { user, timestamp } = message; - const { - displayName, - displayColor, - createdAt, - isModerator: isAuthorModerator, - } = user; + const { displayName, displayColor, createdAt } = user; + const isAuthorModerator = checkIsModerator(message); const isMessageModeratable = isModerator && message.type === SOCKET_MESSAGE_TYPES.CHAT; @@ -75,7 +71,7 @@ export default class ChatMessageView extends Component { isMessageModeratable ? 'moderatable' : '' }`; - const messageAuthorFlair = isModerator + const messageAuthorFlair = isAuthorModerator ? html`