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.
This commit is contained in:
Gabe Kangas 2021-12-11 16:03:24 -08:00
parent 58805f0000
commit c3f9f24624
No known key found for this signature in database
GPG key ID: 9A56337728BC81EA

View file

@ -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"