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, messageBubbleColorForHue,
textColorForHue, textColorForHue,
} from '../../utils/user-colors.js'; } 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 { SOCKET_MESSAGE_TYPES } from '../../utils/websocket.js';
import { getDiffInDaysFromNow } from '../../utils/helpers.js'; import { getDiffInDaysFromNow } from '../../utils/helpers.js';
import ModeratorActions from './moderator-actions.js'; import ModeratorActions from './moderator-actions.js';
@ -42,12 +42,8 @@ export default class ChatMessageView extends Component {
render() { render() {
const { message, isModerator, accessToken } = this.props; const { message, isModerator, accessToken } = this.props;
const { user, timestamp } = message; const { user, timestamp } = message;
const { const { displayName, displayColor, createdAt } = user;
displayName, const isAuthorModerator = checkIsModerator(message);
displayColor,
createdAt,
isModerator: isAuthorModerator,
} = user;
const isMessageModeratable = const isMessageModeratable =
isModerator && message.type === SOCKET_MESSAGE_TYPES.CHAT; isModerator && message.type === SOCKET_MESSAGE_TYPES.CHAT;
@ -75,7 +71,7 @@ export default class ChatMessageView extends Component {
isMessageModeratable ? 'moderatable' : '' isMessageModeratable ? 'moderatable' : ''
}`; }`;
const messageAuthorFlair = isModerator const messageAuthorFlair = isAuthorModerator
? html`<img ? html`<img
class="flair" class="flair"
title="Moderator" title="Moderator"