Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include system messages in unread count #1350

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
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
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
Loading