Rename method to better describe what it does
This commit is contained in:
parent
7cbb1b23b2
commit
f7ef334fac
@ -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});
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 <messsage> stanza
|
||||
*/
|
||||
incrementUnreadMsgCounter (message) {
|
||||
handleUnreadMessage (message) {
|
||||
if (!message?.get('body')) {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user