Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/channel_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,17 @@ export class ChannelState<StreamChatGenerics extends ExtendableGenerics = Defaul
*
*/
filterErrorMessages() {
const filteredMessages = this.latestMessages.filter((message) => message.type !== 'error');
const userId = this._channel.getClient().userID;

if (!userId) return;

const filteredMessages = this.latestMessages.filter(
(message) =>
!(
message.type === 'error' &&
(message.user?.id === userId || message.user_id === userId)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arnautov-anton can we add this as a param like onlyOwnMessages or similar? To avoid changing the method's behavior. Btw this is a bit of a weird behavior because this means that async moderated messages will be filtered for the sender, but not for receivers. But I understand the reason for this.

),
);

this.latestMessages = filteredMessages;
}
Expand Down