Skip to content

Fix intermittent missing new message count badge (Issue #4110) - #4111

Open
abhiramvsmg wants to merge 2 commits into
conversejs:masterfrom
abhiramvsmg:master
Open

Fix intermittent missing new message count badge (Issue #4110)#4111
abhiramvsmg wants to merge 2 commits into
conversejs:masterfrom
abhiramvsmg:master

Conversation

@abhiramvsmg

Copy link
Copy Markdown

This fixes a timing race condition where the roster badge fails to update with new unread messages if they arrive before the linked roster contact object has finished loading asynchronously.

Changes :

Fix : Added a call to this.updateContactUnreadCounter() inside setModelContact in src/headless/shared/model-with-contact.js to sync the unread counter as soon as the contact resolves.

Test : Added a regression integration test in src/headless/plugins/chat/tests/chat.js that mock-delays the contact load, sets the unread count, and asserts that the contact's unread badge synchronizes correctly upon resolution.

Changelog : Added an entry for Issue #4110 in CHANGES.md.


if (contact) {
this.contact = contact;
this.updateContactUnreadCounter();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Further down in this if statement the contact:add event is triggered and the ModelWithContact model already listens for that event and then calls updateContactUnreadCounter().

So this change here look unnecessary.

Also, the test passes without this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants