Explorar o código

I think this fixes #1160

Don't included MAM data form if there's nothing to filter
JC Brand %!s(int64=6) %!d(string=hai) anos
pai
achega
99432eebd9
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/converse-mam.js

+ 4 - 2
src/converse-mam.js

@@ -43,10 +43,11 @@
         if (_.isFunction(options)) {
             callback = options;
             errback = callback;
+            options = null;
         }
         const queryid = _converse.connection.getUniqueId();
         const attrs = {'type':'set'};
-        if (!_.isUndefined(options) && options.groupchat) {
+        if (options && options.groupchat) {
             if (!options['with']) { // eslint-disable-line dot-notation
                 throw new Error(
                     'You need to specify a "with" value containing '+
@@ -54,8 +55,9 @@
             }
             attrs.to = options['with']; // eslint-disable-line dot-notation
         }
+
         const stanza = $iq(attrs).c('query', {'xmlns':Strophe.NS.MAM, 'queryid':queryid});
-        if (!_.isUndefined(options)) {
+        if (options) {
             stanza.c('x', {'xmlns':Strophe.NS.XFORM, 'type': 'submit'})
                     .c('field', {'var':'FORM_TYPE', 'type': 'hidden'})
                     .c('value').t(Strophe.NS.MAM).up().up();