summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Kangas <gabek@real-ity.com>2021-12-11 16:03:24 -0800
committerGabe Kangas <gabek@real-ity.com>2021-12-11 16:03:24 -0800
commitc3f9f246247851035cf8350a5119666e6b307f8d (patch)
treee569beb5b22a269f05bbf321cf6ea69e1cebb073
parent58805f0000753b696fabf11795325e7c17490309 (diff)
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.
-rw-r--r--webroot/js/components/chat/chat-message-view.js12
1 files 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`<img
class="flair"
title="Moderator"