Explorar o código

Re-add check for `allow_non_roster_messaging`

JC Brand %!s(int64=6) %!d(string=hai) anos
pai
achega
0169d86b11
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  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);
                     contact_jid = Strophe.getBareJidFromJid(to_jid);
                 } else {
                 } else {
                     contact_jid = from_bare_jid;
                     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
                 // 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,
                 const has_body = sizzle(`body, encrypted[xmlns="${Strophe.NS.OMEMO}"]`, stanza).length > 0,