I think this fixes #1160

Don't included MAM data form if there's nothing to filter
This commit is contained in:
JC Brand 2018-09-06 16:56:13 +02:00
parent 012dd1328a
commit 99432eebd9

View File

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