Commit 11ac846b authored by JC Brand's avatar JC Brand

Fixes #1259

parent f0c5f697
......@@ -4,9 +4,10 @@
- Use [Lerna](https://lernajs.io/) to create the @converse/headless package
- Use ES2015 modules instead of UMD.
- #1252 Correctly reflect the state in bookmark icon title.
- #1257 Prefer 'probably' over 'maybe' when evaluating audio play support.
- #1259 Don't inform of affiliation change after user leaves MUC
- #1261 File upload not working
- #1252 Correctly reflect the state in bookmark icon title.
- #1272 Hiding MUC occupants leaves a blank space
## 4.0.3 (2018-10-22)
......
......@@ -63342,6 +63342,10 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
},
informOfOccupantsRoleChange(occupant, changed) {
if (changed === "none") {
return;
}
const previous_role = occupant._previousAttributes.role;
if (previous_role === 'moderator') {
......@@ -290,8 +290,8 @@
</p>
<p>
Currently the <strong>conversejs.org</strong> XMPP
server does not support HTTP-file upload, which means
that we don't host any uploaded files of users.
server does not support HTTP-file upload (although Converse the client does),
which means that we don't host any uploaded files of users.
</p>
<p>
During normal operations we don't log or process IP
......
......@@ -930,6 +930,70 @@
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL))
}));
it("role-change messages that follow a MUC leave are left out",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) {
// See https://github.com/conversejs/converse.js/issues/1259
await test_utils.openAndEnterChatRoom(_converse, 'conversations', 'conference.siacs.eu', 'dummy');
const presence = $pres({
to: 'dummy@localhost/resource',
from: 'conversations@conference.siacs.eu/Guus'
}).c('x', {
'xmlns': Strophe.NS.MUC_USER
}).c('item', {
'affiliation': 'none',
'jid': 'Guus@localhost/xxx',
'role': 'visitor'
});
_converse.connection._dataRecv(test_utils.createRequest(presence));
const view = _converse.chatboxviews.get('conversations@conference.siacs.eu');
const msg = $msg({
'from': 'conversations@conference.siacs.eu/dummy',
'id': (new Date()).getTime(),
'to': 'dummy@localhost',
'type': 'groupchat'
}).c('body').t('Some message').tree();
view.model.onMessage(msg);
await new Promise((resolve, reject) => view.once('messageInserted', resolve));
let stanza = Strophe.xmlHtmlNode(
`<presence xmlns="jabber:client" to="dummy@localhost/resource" type="unavailable" from="conversations@conference.siacs.eu/Guus">
<x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="none" role="none"/>
</x>
</presence>`
).firstElementChild;
_converse.connection._dataRecv(test_utils.createRequest(stanza));
stanza = Strophe.xmlHtmlNode(
`<presence xmlns="jabber:client" to="dummy@localhost/resource" from="conversations@conference.siacs.eu/Guus">
<c xmlns="http://jabber.org/protocol/caps" node="http://conversations.im" ver="ISg6+9AoK1/cwhbNEDviSvjdPzI=" hash="sha-1"/>
<x xmlns="vcard-temp:x:update">
<photo>bf987c486c51fbc05a6a4a9f20dd19b5efba3758</photo>
</x>
<x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="none" role="visitor"/>
</x>
</presence>`
).firstElementChild;
_converse.connection._dataRecv(test_utils.createRequest(stanza));
const chat_content = view.el.querySelector('.chat-content');
const messages = chat_content.querySelectorAll('div.chat-info');
expect(messages.length).toBe(3);
expect(messages[0].textContent).toBe('dummy has entered the groupchat');
expect(messages[1].textContent).toBe('Guus has entered the groupchat');
expect(messages[2].textContent).toBe('Guus has left and re-entered the groupchat');
done();
}));
it("shows a new day indicator if a join/leave message is received on a new day",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {},
......
......@@ -645,6 +645,9 @@ converse.plugins.add('converse-muc-views', {
},
informOfOccupantsRoleChange (occupant, changed) {
if (changed === "none") {
return;
}
const previous_role = occupant._previousAttributes.role;
if (previous_role === 'moderator') {
this.showChatEvent(__("%1$s is no longer a moderator", occupant.get('nick')))
......
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