converse-muc: occupantAdded promise has been removed

Also:

* converted two docstrings into JSDoc format
* Don't use `_.isNull`
This commit is contained in:
JC Brand 2019-08-14 08:51:06 +02:00
parent 9c024757b6
commit bcc73fe727
3 changed files with 17 additions and 13 deletions

View File

@ -111,12 +111,10 @@ converse.plugins.add('converse-message-view', {
});
}
if (this.model.occupantAdded) {
this.model.occupantAdded.then(() => {
this.model.occupant.on('change:role', this.debouncedRender, this);
this.model.occupant.on('change:affiliation', this.debouncedRender, this);
this.debouncedRender();
});
if (this.model.occupant) {
this.model.occupant.on('change:role', this.debouncedRender, this);
this.model.occupant.on('change:affiliation', this.debouncedRender, this);
this.debouncedRender();
}
this.model.on('change', this.onChanged, this);

View File

@ -1010,20 +1010,26 @@ converse.plugins.add('converse-chatboxes', {
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 () {
/* Returns a boolean to indicate whether a newly received
* message will be visible to the user or not.
*/
return this.get('hidden') ||
this.get('minimized') ||
this.isScrolledUp() ||
_converse.windowState === 'hidden';
},
/**
* Given a newly received {@link _converse.Message} instance,
* update the unread counter if necessary.
* @private
* @param {_converse.Message} message
*/
incrementUnreadMsgCounter (message) {
/* Given a newly received message, update the unread counter if
* necessary.
*/
if (!message || !message.get('message')) {
return;
}

View File

@ -1602,7 +1602,7 @@ converse.plugins.add('converse-muc', {
* @param { XMLElement } stanza: The presence stanza received
*/
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();
if (!x) {
return;