diff --git a/spec/controlbox.js b/spec/controlbox.js index 784e9e8db..bba3bacbc 100644 --- a/spec/controlbox.js +++ b/spec/controlbox.js @@ -89,7 +89,7 @@ describe("The Controlbox", function () { .c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree(); _converse.handleMessageStanza(msg); await u.waitUntil(() => _converse.rosterview.el.querySelectorAll(".msgs-indicator").length); - spyOn(chatview.model, 'incrementUnreadMsgCounter').and.callThrough(); + spyOn(chatview.model, 'handleUnreadMessage').and.callThrough(); await u.waitUntil(() => _converse.chatboxviews.el.querySelector('.restore-chat .message-count')?.textContent === '1'); expect(_converse.rosterview.el.querySelector('.msgs-indicator').textContent).toBe('1'); @@ -101,7 +101,7 @@ describe("The Controlbox", function () { }).c('body').t('hello again').up() .c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree(); _converse.handleMessageStanza(msg); - await u.waitUntil(() => chatview.model.incrementUnreadMsgCounter.calls.count()); + await u.waitUntil(() => chatview.model.handleUnreadMessage.calls.count()); await u.waitUntil(() => _converse.chatboxviews.el.querySelector('.restore-chat .message-count')?.textContent === '2'); expect(_converse.rosterview.el.querySelector('.msgs-indicator').textContent).toBe('2'); chatview.model.set({'minimized': false}); diff --git a/spec/muclist.js b/spec/muclist.js index 0e27abe4e..265b7629d 100644 --- a/spec/muclist.js +++ b/spec/muclist.js @@ -315,7 +315,7 @@ describe("A groupchat shown in the groupchats list", function () { let indicator_el = await u.waitUntil(() => lview.el.querySelector(".msgs-indicator")); expect(indicator_el.textContent).toBe('1'); - spyOn(view.model, 'incrementUnreadMsgCounter').and.callThrough(); + spyOn(view.model, 'handleUnreadMessage').and.callThrough(); await view.model.handleMessageStanza( $msg({ from: room_jid+'/'+nick, @@ -324,7 +324,7 @@ describe("A groupchat shown in the groupchats list", function () { type: 'groupchat' }).c('body').t('romeo: and another thing...').tree() ); - await u.waitUntil(() => view.model.incrementUnreadMsgCounter.calls.count()); + await u.waitUntil(() => view.model.handleUnreadMessage.calls.count()); await u.waitUntil(() => lview.el.querySelector(".msgs-indicator").textContent === '2', 1000); // When the chat gets maximized again, the unread indicators are removed diff --git a/src/headless/converse-chat.js b/src/headless/converse-chat.js index f56cf86e5..383cc7ef1 100644 --- a/src/headless/converse-chat.js +++ b/src/headless/converse-chat.js @@ -475,7 +475,7 @@ converse.plugins.add('converse-chat', { if (u.shouldCreateMessage(attrs)) { const msg = this.handleCorrection(attrs) || await this.createMessage(attrs); this.notifications.set({'chat_state': null}); - this.incrementUnreadMsgCounter(msg); + this.handleUnreadMessage(msg); } } }, @@ -1154,7 +1154,7 @@ converse.plugins.add('converse-chat', { * @private * @param {_converse.Message} message */ - incrementUnreadMsgCounter (message) { + handleUnreadMessage (message) { if (!message?.get('body')) { return } diff --git a/src/headless/converse-muc.js b/src/headless/converse-muc.js index 619de42e2..4fbe3b758 100644 --- a/src/headless/converse-muc.js +++ b/src/headless/converse-muc.js @@ -2014,7 +2014,7 @@ converse.plugins.add('converse-muc', { if (u.shouldCreateGroupchatMessage(attrs)) { const msg = this.handleCorrection(attrs) || await this.createMessage(attrs); this.removeNotification(attrs.nick, ['composing', 'paused']); - this.incrementUnreadMsgCounter(msg); + this.handleUnreadMessage(msg); } }, @@ -2402,10 +2402,10 @@ converse.plugins.add('converse-muc', { /* Given a newly received message, update the unread counter if necessary. * @private - * @method _converse.ChatRoom#incrementUnreadMsgCounter + * @method _converse.ChatRoom#handleUnreadMessage * @param { XMLElement } - The stanza */ - incrementUnreadMsgCounter (message) { + handleUnreadMessage (message) { if (!message?.get('body')) { return }