Skip to content

Commit

Permalink
fix(chat-view-container): correctly filter out reaction admin message…
Browse files Browse the repository at this point in the history
…s from chat (#2347)
  • Loading branch information
domw30 authored Oct 8, 2024
1 parent 4355ce6 commit 8173a48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/components/chat-view-container/chat-view-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -153,7 +154,9 @@ export class Container extends React.Component<Properties> {
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);
Expand Down
4 changes: 2 additions & 2 deletions src/components/chat-view-container/chat-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -140,7 +140,7 @@ export class ChatView extends React.Component<Properties, State> {

renderMessageGroup(groupMessages) {
return groupMessages.map((message, index) => {
if (message.isAdmin && message.admin.type !== AdminMessageType.REACTION) {
if (message.isAdmin) {
return <AdminMessageContainer key={message.optimisticId || message.id} message={message} />;
} else {
const messageRenderProps = getMessageRenderProps(
Expand Down

0 comments on commit 8173a48

Please sign in to comment.