Prechádzať zdrojové kódy

Avoid creating a headlines box...

if we don't have anything to show inside it.

Updates #1221
JC Brand 6 rokov pred
rodič
commit
23e9c48e53
3 zmenil súbory, kde vykonal 13 pridanie a 1 odobranie
  1. 1 0
      CHANGES.md
  2. 7 1
      dist/converse.js
  3. 5 0
      src/converse-headline.js

+ 1 - 0
CHANGES.md

@@ -9,6 +9,7 @@
 - #1199 Can't get back from to login screen from registration screen
 - #1204 Link encoding issue
 - #1214 Setting `allow_contact_requests` to `false` has no effect
+- #1221 Avoid creating a headlines box if we don't have anything to show inside it
 - #1222 Adding a bookmark should prefill the room name
 
 ## 4.0.2 (2018-10-02)

+ 7 - 1
dist/converse.js

@@ -66438,6 +66438,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
             return;
           }
 
+          if (_.isNull(message.querySelector('body'))) {
+            // Avoid creating a chat box if we have nothing to show
+            // inside it.
+            return;
+          }
+
           const chatbox = _converse.chatboxes.create({
             'id': from_jid,
             'jid': from_jid,
@@ -71804,7 +71810,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
           if (sizzle('item-not-found[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]', iq).length) {
             this.feedback.set('error', __(`Error: the groupchat ${this.model.getDisplayName()} does not exist.`));
           } else if (sizzle('not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
-            this.feedback.set('error', __(`Sorry, you're not allowed to registerd in this groupchat`));
+            this.feedback.set('error', __(`Sorry, you're not allowed to register in this groupchat`));
           }
         });
       }

+ 5 - 0
src/converse-headline.js

@@ -117,6 +117,11 @@
                     if (_.includes(from_jid, '@') && !_converse.allow_non_roster_messaging) {
                         return;
                     }
+                    if (_.isNull(message.querySelector('body'))) {
+                        // Avoid creating a chat box if we have nothing to show
+                        // inside it.
+                        return;
+                    }
                     const chatbox = _converse.chatboxes.create({
                         'id': from_jid,
                         'jid': from_jid,