Commit aa90ebd7 authored by JC Brand's avatar JC Brand

Bugfix. Don't delete JID or resource...

when an affiliation change presence is received.
parent 23455679
......@@ -32702,7 +32702,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
//# sourceMappingURL=pluggable.js.map
/***/ }),
/***/ "./node_modules/process/browser.js":
......@@ -67520,11 +67519,11 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
}
const jid = Strophe.getBareJidFromJid(data.jid);
const jid = data.jid || '';
const attributes = _.extend(data, {
'jid': jid ? jid : undefined,
'resource': data.jid ? Strophe.getResourceFromJid(data.jid) : undefined
'jid': Strophe.getBareJidFromJid(jid) || _.get(occupant, 'attributes.jid'),
'resource': Strophe.getResourceFromJid(jid) || _.get(occupant, 'attributes.resource')
});
if (occupant) {
This diff is collapsed.
......@@ -4645,14 +4645,13 @@
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trollbox', 'localhost', 'troll');
var sent_IQ, IQ_id;
var sendIQ = _converse.connection.sendIQ;
let sent_IQ, IQ_id;
const sendIQ = _converse.connection.sendIQ;
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback);
});
const view = _converse.chatboxviews.get('trollbox@localhost');
const textarea = view.el.querySelector('.chat-textarea');
textarea.value = 'Hello world';
view.onFormSubmitted(new Event('submit'));
......@@ -4668,6 +4667,48 @@
"Your message was not delivered because you're not allowed to send messages in this groupchat.");
done();
}));
it("will see an explanatory message instead of a textarea",
mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trollbox', 'localhost', 'troll');
const view = _converse.chatboxviews.get('trollbox@localhost');
let stanza = u.toStanza(`
<presence
from='trollbox@localhost/troll'
to='dummy@localhost/resource'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='moderator'
nick='troll'
role='visitor'/>
<status code='110'/>
</x>
</presence>`);
_converse.connection._dataRecv(test_utils.createRequest(stanza));
let info_msgs = sizzle('.chat-info', view.el);
expect(info_msgs.length).toBe(4);
expect(info_msgs[2].textContent).toBe("troll is no longer a moderator");
expect(info_msgs[3].textContent).toBe("troll has been muted");
stanza = u.toStanza(`
<presence
from='trollbox@localhost/troll'
to='dummy@localhost/resource'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item affiliation='moderator'
nick='troll'
role='participant'/>
<status code='110'/>
</x>
</presence>`);
_converse.connection._dataRecv(test_utils.createRequest(stanza));
info_msgs = sizzle('.chat-info', view.el);
expect(info_msgs.length).toBe(5);
expect(info_msgs[4].textContent).toBe("troll has been given a voice again");
done();
}));
});
});
}));
......@@ -910,10 +910,10 @@ converse.plugins.add('converse-muc', {
return;
}
}
const jid = Strophe.getBareJidFromJid(data.jid);
const jid = data.jid || '';
const attributes = _.extend(data, {
'jid': jid ? jid : undefined,
'resource': data.jid ? Strophe.getResourceFromJid(data.jid) : undefined
'jid': Strophe.getBareJidFromJid(jid) || _.get(occupant, 'attributes.jid'),
'resource': Strophe.getResourceFromJid(jid) || _.get(occupant, 'attributes.resource')
});
if (occupant) {
occupant.save(attributes);
......
......@@ -30205,7 +30205,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
//# sourceMappingURL=pluggable.js.map
/***/ }),
/***/ "./node_modules/process/browser.js":
......@@ -46037,11 +46036,11 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
}
const jid = Strophe.getBareJidFromJid(data.jid);
const jid = data.jid || '';
const attributes = _.extend(data, {
'jid': jid ? jid : undefined,
'resource': data.jid ? Strophe.getResourceFromJid(data.jid) : undefined
'jid': Strophe.getBareJidFromJid(jid) || _.get(occupant, 'attributes.jid'),
'resource': Strophe.getResourceFromJid(jid) || _.get(occupant, 'attributes.resource')
});
if (occupant) {
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment