Commit bcc73fe7 authored by JC Brand's avatar JC Brand

converse-muc: `occupantAdded` promise has been removed

Also:

* converted two docstrings into JSDoc format
* Don't use `_.isNull`
parent 9c024757
...@@ -111,12 +111,10 @@ converse.plugins.add('converse-message-view', { ...@@ -111,12 +111,10 @@ converse.plugins.add('converse-message-view', {
}); });
} }
if (this.model.occupantAdded) { if (this.model.occupant) {
this.model.occupantAdded.then(() => { this.model.occupant.on('change:role', this.debouncedRender, this);
this.model.occupant.on('change:role', this.debouncedRender, this); this.model.occupant.on('change:affiliation', this.debouncedRender, this);
this.model.occupant.on('change:affiliation', this.debouncedRender, this); this.debouncedRender();
this.debouncedRender();
});
} }
this.model.on('change', this.onChanged, this); this.model.on('change', this.onChanged, this);
......
...@@ -1010,20 +1010,26 @@ converse.plugins.add('converse-chatboxes', { ...@@ -1010,20 +1010,26 @@ converse.plugins.add('converse-chatboxes', {
return this.trigger("show"); return this.trigger("show");
}, },
/**
* Indicates whether the chat is hidden and therefore
* whether a newly received message will be visible
* to the user or not.
* @returns {boolean}
*/
isHidden () { isHidden () {
/* Returns a boolean to indicate whether a newly received
* message will be visible to the user or not.
*/
return this.get('hidden') || return this.get('hidden') ||
this.get('minimized') || this.get('minimized') ||
this.isScrolledUp() || this.isScrolledUp() ||
_converse.windowState === 'hidden'; _converse.windowState === 'hidden';
}, },
/**
* Given a newly received {@link _converse.Message} instance,
* update the unread counter if necessary.
* @private
* @param {_converse.Message} message
*/
incrementUnreadMsgCounter (message) { incrementUnreadMsgCounter (message) {
/* Given a newly received message, update the unread counter if
* necessary.
*/
if (!message || !message.get('message')) { if (!message || !message.get('message')) {
return; return;
} }
......
...@@ -1602,7 +1602,7 @@ converse.plugins.add('converse-muc', { ...@@ -1602,7 +1602,7 @@ converse.plugins.add('converse-muc', {
* @param { XMLElement } stanza: The presence stanza received * @param { XMLElement } stanza: The presence stanza received
*/ */
createInfoMessages (stanza) { createInfoMessages (stanza) {
const is_self = !_.isNull(stanza.querySelector("status[code='110']")); const is_self = stanza.querySelector("status[code='110']") !== null;
const x = sizzle(`x[xmlns="${Strophe.NS.MUC_USER}"]`, stanza).pop(); const x = sizzle(`x[xmlns="${Strophe.NS.MUC_USER}"]`, stanza).pop();
if (!x) { if (!x) {
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment