فهرست منبع

converse-muc: `occupantAdded` promise has been removed

Also:

* converted two docstrings into JSDoc format
* Don't use `_.isNull`
JC Brand 5 سال پیش
والد
کامیت
bcc73fe727
3فایلهای تغییر یافته به همراه17 افزوده شده و 13 حذف شده
  1. 4 6
      src/converse-message-view.js
  2. 12 6
      src/headless/converse-chatboxes.js
  3. 1 1
      src/headless/converse-muc.js

+ 4 - 6
src/converse-message-view.js

@@ -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);

+ 12 - 6
src/headless/converse-chatboxes.js

@@ -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;
                 }

+ 1 - 1
src/headless/converse-muc.js

@@ -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;