Skip to content

Commit

Permalink
fix: include system messages in unread count (#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
myandrienko committed Sep 4, 2024
1 parent 8eda557 commit 9f1d27a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,6 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
if (message.parent_id && !message.show_in_channel) return false;
if (message.user?.id === this.getClient().userID) return false;
if (message.user?.id && this.getClient().userMuteStatus(message.user.id)) return false;
if (message.type === 'system') return false;

// Return false if channel doesn't allow read events.
if (Array.isArray(this.data?.own_capabilities) && !this.data?.own_capabilities.includes('read-events'))
Expand Down
4 changes: 2 additions & 2 deletions test/unit/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ describe('Channel count unread', function () {
expect(channel._countMessageAsUnread({ user })).not.to.be.ok;
});

it('_countMessageAsUnread should return false for system messages', function () {
expect(channel._countMessageAsUnread({ type: 'system' })).not.to.be.ok;
it('_countMessageAsUnread should return true for system messages', function () {
expect(channel._countMessageAsUnread({ type: 'system' })).to.be.true;
});

it('_countMessageAsUnread should return false for muted user', function () {
Expand Down

0 comments on commit 9f1d27a

Please sign in to comment.