From 8173a485e7d8567fac2c77108a1c809a660d1ef0 Mon Sep 17 00:00:00 2001 From: DomW Date: Tue, 8 Oct 2024 14:17:00 +0100 Subject: [PATCH] fix(chat-view-container): correctly filter out reaction admin messages from chat (#2347) --- src/components/chat-view-container/chat-view-container.tsx | 5 ++++- src/components/chat-view-container/chat-view.tsx | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/chat-view-container/chat-view-container.tsx b/src/components/chat-view-container/chat-view-container.tsx index 0aa77ee9b..94a672592 100644 --- a/src/components/chat-view-container/chat-view-container.tsx +++ b/src/components/chat-view-container/chat-view-container.tsx @@ -10,6 +10,7 @@ import { EditMessageOptions, loadAttachmentDetails, Media, + AdminMessageType, } from '../../store/messages'; import { Channel, ConversationStatus, denormalize, onReply } from '../../store/channels'; import { ChatView } from './chat-view'; @@ -153,7 +154,9 @@ export class Container extends React.Component { get messages() { const allMessages = this.channel?.messages || []; - const chatMessages = allMessages.filter((message) => !message.isPost); + const chatMessages = allMessages.filter( + (message) => !message.isPost && (!message.admin || message.admin?.type !== AdminMessageType.REACTION) + ); const messagesById = mapMessagesById(chatMessages); const messagesByRootId = mapMessagesByRootId(chatMessages); diff --git a/src/components/chat-view-container/chat-view.tsx b/src/components/chat-view-container/chat-view.tsx index 874cc3643..c7fff08a2 100644 --- a/src/components/chat-view-container/chat-view.tsx +++ b/src/components/chat-view-container/chat-view.tsx @@ -2,7 +2,7 @@ import React, { Fragment } from 'react'; import { Waypoint } from 'react-waypoint'; import classNames from 'classnames'; import moment from 'moment'; -import { Message as MessageModel, MediaType, EditMessageOptions, Media, AdminMessageType } from '../../store/messages'; +import { Message as MessageModel, MediaType, EditMessageOptions, Media } from '../../store/messages'; import InvertedScroll from '../inverted-scroll'; import { Lightbox } from '@zer0-os/zos-component-library'; import { User } from '../../store/authentication/types'; @@ -140,7 +140,7 @@ export class ChatView extends React.Component { renderMessageGroup(groupMessages) { return groupMessages.map((message, index) => { - if (message.isAdmin && message.admin.type !== AdminMessageType.REACTION) { + if (message.isAdmin) { return ; } else { const messageRenderProps = getMessageRenderProps(