Browse Source

Re-add check for `allow_non_roster_messaging`

JC Brand 6 years ago
parent
commit
0169d86b11
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/headless/converse-chatboxes.js

+ 5 - 0
src/headless/converse-chatboxes.js

@@ -845,6 +845,11 @@ converse.plugins.add('converse-chatboxes', {
                     contact_jid = Strophe.getBareJidFromJid(to_jid);
                 } else {
                     contact_jid = from_bare_jid;
+                    await _converse.api.waitUntil('rosterContactsFetched');
+                    const roster_item = _converse.roster.get(contact_jid);
+                    if (_.isUndefined(roster_item) && !_converse.allow_non_roster_messaging) {
+                        return;
+                    }
                 }
                 // Get chat box, but only create when the message has something to show to the user
                 const has_body = sizzle(`body, encrypted[xmlns="${Strophe.NS.OMEMO}"]`, stanza).length > 0,