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) {
......@@ -875,16 +875,16 @@
}
},
"@lerna/changed": {
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/@lerna/changed/-/changed-3.13.1.tgz",
"integrity": "sha512-BRXitEJGOkoudbxEewW7WhjkLxFD+tTk4PrYpHLyCBk63pNTWtQLRE6dc1hqwh4emwyGncoyW6RgXfLgMZgryw==",
"version": "3.13.2",
"resolved": "https://registry.npmjs.org/@lerna/changed/-/changed-3.13.2.tgz",
"integrity": "sha512-mcmkxUMR0J4ZyRyVUrdDJl4ZsdHDgdA1xQcbdB4LZvAE/E2lNlPcEfAfbfs08VnRiqvFOqcczbzBq10hvSFg4w==",
"dev": true,
"requires": {
"@lerna/collect-updates": "3.13.0",
"@lerna/command": "3.13.1",
"@lerna/listable": "3.13.0",
"@lerna/output": "3.13.0",
"@lerna/version": "3.13.1"
"@lerna/version": "3.13.2"
}
},
"@lerna/check-working-tree": {
......@@ -1468,15 +1468,16 @@
}
},
"@lerna/npm-publish": {
"version": "3.13.0",
"resolved": "https://registry.npmjs.org/@lerna/npm-publish/-/npm-publish-3.13.0.tgz",
"integrity": "sha512-y4WO0XTaf9gNRkI7as6P2ItVDOxmYHwYto357fjybcnfXgMqEA94c3GJ++jU41j0A9vnmYC6/XxpTd9sVmH9tA==",
"version": "3.13.2",
"resolved": "https://registry.npmjs.org/@lerna/npm-publish/-/npm-publish-3.13.2.tgz",
"integrity": "sha512-HMucPyEYZfom5tRJL4GsKBRi47yvSS2ynMXYxL3kO0ie+j9J7cb0Ir8NmaAMEd3uJWJVFCPuQarehyfTDZsSxg==",
"dev": true,
"requires": {
"@lerna/run-lifecycle": "3.13.0",
"figgy-pudding": "^3.5.1",
"fs-extra": "^7.0.0",
"libnpmpublish": "^1.1.1",
"npm-package-arg": "^6.1.0",
"npmlog": "^4.1.2",
"pify": "^3.0.0",
"read-package-json": "^2.0.13"
......@@ -1733,9 +1734,9 @@
}
},
"@lerna/publish": {
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/@lerna/publish/-/publish-3.13.1.tgz",
"integrity": "sha512-KhCJ9UDx76HWCF03i5TD7z5lX+2yklHh5SyO8eDaLptgdLDQ0Z78lfGj3JhewHU2l46FztmqxL/ss0IkWHDL+g==",
"version": "3.13.2",
"resolved": "https://registry.npmjs.org/@lerna/publish/-/publish-3.13.2.tgz",
"integrity": "sha512-L8iceC3Z2YJnlV3cGbfk47NSh1+iOo1tD65z+BU3IYLRpPnnSf8i6BORdKV8rECDj6kjLYvL7//2yxbHy7shhA==",
"dev": true,
"requires": {
"@lerna/batch-packages": "3.13.0",
......@@ -1747,7 +1748,7 @@
"@lerna/log-packed": "3.13.0",
"@lerna/npm-conf": "3.13.0",
"@lerna/npm-dist-tag": "3.13.0",
"@lerna/npm-publish": "3.13.0",
"@lerna/npm-publish": "3.13.2",
"@lerna/output": "3.13.0",
"@lerna/pack-directory": "3.13.1",
"@lerna/prompt": "3.13.0",
......@@ -1755,7 +1756,7 @@
"@lerna/run-lifecycle": "3.13.0",
"@lerna/run-parallel-batches": "3.13.0",
"@lerna/validation-error": "3.13.0",
"@lerna/version": "3.13.1",
"@lerna/version": "3.13.2",
"figgy-pudding": "^3.5.1",
"fs-extra": "^7.0.0",
"libnpmaccess": "^3.0.1",
......@@ -1884,9 +1885,9 @@
}
},
"@lerna/version": {
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/@lerna/version/-/version-3.13.1.tgz",
"integrity": "sha512-WpfKc5jZBBOJ6bFS4atPJEbHSiywQ/Gcd+vrwaEGyQHWHQZnPTvhqLuq3q9fIb9sbuhH5pSY6eehhuBrKqTnjg==",
"version": "3.13.2",
"resolved": "https://registry.npmjs.org/@lerna/version/-/version-3.13.2.tgz",
"integrity": "sha512-85AEn6Cx5p1VOejEd5fpTyeDCx6yejSJCgbILkx+gXhLhFg2XpFzLswMd+u71X7RAttWHvhzeKJAw4tWTXDvpQ==",
"dev": true,
"requires": {
"@lerna/batch-packages": "3.13.0",
......@@ -1953,9 +1954,9 @@
"dev": true
},
"@octokit/endpoint": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-3.2.3.tgz",
"integrity": "sha512-yUPCt4vMIOclox13CUxzuKiPJIFo46b/6GhUnUTw5QySczN1L0DtSxgmIZrZV4SAb9EyAqrceoyrWoYVnfF2AA==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-4.0.0.tgz",
"integrity": "sha512-b8sptNUekjREtCTJFpOfSIL4SKh65WaakcyxWzRcSPOk5RxkZJ/S8884NGZFxZ+jCB2rDURU66pSHn14cVgWVg==",
"dev": true,
"requires": {
"deepmerge": "3.2.0",
......@@ -1971,12 +1972,12 @@
"dev": true
},
"@octokit/request": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-2.4.2.tgz",
"integrity": "sha512-lxVlYYvwGbKSHXfbPk5vxEA8w4zHOH1wobado4a9EfsyD3Cbhuhus1w0Ye9Ro0eMubGO8kNy5d+xNFisM3Tvaw==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-3.0.0.tgz",
"integrity": "sha512-DZqmbm66tq+a9FtcKrn0sjrUpi0UaZ9QPUCxxyk/4CJ2rseTMpAWRf6gCwOSUCzZcx/4XVIsDk+kz5BVdaeenA==",
"dev": true,
"requires": {
"@octokit/endpoint": "^3.2.0",
"@octokit/endpoint": "^4.0.0",
"deprecation": "^1.0.1",
"is-plain-object": "^2.0.4",
"node-fetch": "^2.3.0",
......@@ -1985,12 +1986,12 @@
}
},
"@octokit/rest": {
"version": "16.23.2",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.23.2.tgz",
"integrity": "sha512-ZxiZMaCuqBG/IsbgNRVfGwYsvBb5DjHuMGjJgOrinT+/b+1j1U7PiGyRkHDJdjTGA6N/PsMC2lP2ZybX9579iA==",
"version": "16.23.4",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.23.4.tgz",
"integrity": "sha512-fQuYQ0vgNLkzeN0KEsqN0aS6EPzcuaePT5M5cE5qnKayaxFwRIQOMhNR/rTmEqo/zDK/20ZAcHsgLKodSsJtww==",
"dev": true,
"requires": {
"@octokit/request": "2.4.2",
"@octokit/request": "3.0.0",
"atob-lite": "^2.0.0",
"before-after-hook": "^1.4.0",
"btoa-lite": "^1.0.0",
......@@ -4600,9 +4601,9 @@
},
"dependencies": {
"js-yaml": {
"version": "3.13.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.0.tgz",
"integrity": "sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ==",
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
......@@ -8391,14 +8392,14 @@
"dev": true
},
"lerna": {
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/lerna/-/lerna-3.13.1.tgz",
"integrity": "sha512-7kSz8LLozVsoUNTJzJzy+b8TnV9YdviR2Ee2PwGZSlVw3T1Rn7kOAPZjEi+3IWnOPC96zMPHVmjCmzQ4uubalw==",
"version": "3.13.2",
"resolved": "https://registry.npmjs.org/lerna/-/lerna-3.13.2.tgz",
"integrity": "sha512-2iliiFVAMNqaKsVSJ90p49dur93d5RlktotAJNp+uuHsCuIIAvwceqmSgDQCmWu4GkgAom+5uy//KV6F9t8fLA==",
"dev": true,
"requires": {
"@lerna/add": "3.13.1",
"@lerna/bootstrap": "3.13.1",
"@lerna/changed": "3.13.1",
"@lerna/changed": "3.13.2",
"@lerna/clean": "3.13.1",
"@lerna/cli": "3.13.0",
"@lerna/create": "3.13.1",
......@@ -8408,9 +8409,9 @@
"@lerna/init": "3.13.1",
"@lerna/link": "3.13.1",
"@lerna/list": "3.13.1",
"@lerna/publish": "3.13.1",
"@lerna/publish": "3.13.2",
"@lerna/run": "3.13.1",
"@lerna/version": "3.13.1",
"@lerna/version": "3.13.2",
"import-local": "^1.0.0",
"npmlog": "^4.1.2"
}
......@@ -13520,12 +13521,12 @@
}
},
"os-name": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/os-name/-/os-name-3.0.0.tgz",
"integrity": "sha512-7c74tib2FsdFbQ3W+qj8Tyd1R3Z6tuVRNNxXjJcZ4NgjIEQU9N/prVMqcW29XZPXGACqaXN3jq58/6hoaoXH6g==",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz",
"integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==",
"dev": true,
"requires": {
"macos-release": "^2.0.0",
"macos-release": "^2.2.0",
"windows-release": "^3.1.0"
}
},
......@@ -16303,20 +16304,20 @@
}
},
"uglify-js": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.3.tgz",
"integrity": "sha512-rIQPT2UMDnk4jRX+w4WO84/pebU2jiLsjgIyrCktYgSvx28enOE3iYQMr+BD1rHiitWnDmpu0cY/LfIEpKcjcw==",
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.4.tgz",
"integrity": "sha512-GpKo28q/7Bm5BcX9vOu4S46FwisbPbAmkkqPnGIpKvKTM96I85N6XHQV+k4I6FA2wxgLhcsSyHoNhzucwCflvA==",
"dev": true,
"optional": true,
"requires": {
"commander": "~2.19.0",
"commander": "~2.20.0",
"source-map": "~0.6.1"
},
"dependencies": {
"commander": {
"version": "2.19.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz",
"integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==",
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"dev": true,
"optional": true
},
......@@ -17190,12 +17191,12 @@
}
},
"windows-release": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.1.0.tgz",
"integrity": "sha512-hBb7m7acFgQPQc222uEQTmdcGLeBmQLNLFIh0rDk3CwFOBrfjefLzEfEfmpMq8Af/n/GnFf3eYf203FY1PmudA==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz",
"integrity": "sha512-QTlz2hKLrdqukrsapKsINzqMgOUpQW268eJ0OaOpJN32h272waxR9fkB9VoWRtK7uKHG5EHJcTXQBD8XZVJkFA==",
"dev": true,
"requires": {
"execa": "^0.10.0"
"execa": "^1.0.0"
},
"dependencies": {
"cross-spawn": {
......@@ -17212,13 +17213,13 @@
}
},
"execa": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz",
"integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==",
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
"dev": true,
"requires": {
"cross-spawn": "^6.0.0",
"get-stream": "^3.0.0",
"get-stream": "^4.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
......@@ -17226,6 +17227,25 @@
"strip-eof": "^1.0.0"
}
},
"get-stream": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
"dev": true,
"requires": {
"pump": "^3.0.0"
}
},
"pump": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
"dev": true,
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
......@@ -17528,9 +17548,9 @@
}
},
"p-is-promise": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.0.0.tgz",
"integrity": "sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz",
"integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==",
"dev": true
},
"p-limit": {
......
......@@ -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