Change muc_show_disconnection_status
to muc_show_join_leave_status
This commit is contained in:
parent
f7b19053ec
commit
7950f7c2ac
@ -12,7 +12,7 @@
|
||||
- Continuously retry (in 2s intervals) to fetch login credentials (via [credentials_url](https://conversejs.org/docs/html/configuration.html#credentials-url)) in case of failure
|
||||
- Replace `moment` with [DayJS](https://github.com/iamkun/dayjs).
|
||||
- New API method [\_converse.api.disco.features.get](https://conversejs.org/docs/html/api/-_converse.api.disco.features.html#.get)
|
||||
- New config setting [muc_show_disconnection_status](https://conversejs.org/docs/html/configuration.html#muc-show-disconnection-status)
|
||||
- New config setting [muc_show_join_leave_status](https://conversejs.org/docs/html/configuration.html#muc-show-join-leave-status)
|
||||
- New event: `chatBoxBlurred`.
|
||||
- #1296: `embedded` view mode shows `chatbox-navback` arrow in header
|
||||
- #1465: When highlighting a roster contact, they're incorrectly shown as online
|
||||
|
@ -1026,16 +1026,6 @@ all MUCs with set autojoin flag in their respective bookmarks will be joined on
|
||||
startup of Converse. When set to ``false`` no MUCs are automatically joined based on
|
||||
their bookmarks.
|
||||
|
||||
muc_show_disconnection_status
|
||||
-----------------------------
|
||||
|
||||
* Default; ``true``
|
||||
|
||||
Determines whether Converse shows the optionally included status message when a
|
||||
user leaves the MUC.
|
||||
|
||||
See https://xmpp.org/extensions/xep-0045.html#changepres
|
||||
|
||||
muc_show_join_leave
|
||||
-------------------
|
||||
|
||||
@ -1044,6 +1034,17 @@ muc_show_join_leave
|
||||
Determines whether Converse will show info messages inside a chatroom
|
||||
whenever a user joins or leaves it.
|
||||
|
||||
muc_show_join_leave_status
|
||||
--------------------------
|
||||
|
||||
* Default; ``true``
|
||||
|
||||
Determines whether Converse shows the optionally included status message when a
|
||||
user joins or leaves the MUC. This setting only has an effect if
|
||||
``muc_show_join_leave`` is set to ``true``.
|
||||
|
||||
See https://xmpp.org/extensions/xep-0045.html#changepres
|
||||
|
||||
.. _`nickname`:
|
||||
|
||||
nickname
|
||||
|
@ -2656,6 +2656,8 @@
|
||||
});
|
||||
await new Promise((resolve, reject) => view.once('messageInserted', resolve));
|
||||
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
|
||||
expect(view.el.querySelector('.chat-msg .chat-msg__body').textContent.trim())
|
||||
.toBe("But soft, what light through yonder airlock breaks?");
|
||||
|
||||
const msg_obj = view.model.messages.at(0);
|
||||
let stanza = u.toStanza(`
|
||||
|
56
spec/muc.js
56
spec/muc.js
@ -855,6 +855,7 @@
|
||||
presence = u.toStanza(
|
||||
`<presence xmlns="jabber:client" to="dummy@localhost/resource" from="coven@chat.shakespeare.lit/fabio">
|
||||
<c xmlns="http://jabber.org/protocol/caps" node="http://conversations.im" ver="INI3xjRUioclBTP/aACfWi5m9UY=" hash="sha-1"/>
|
||||
<status>Ready for a new day</status>
|
||||
<x xmlns="http://jabber.org/protocol/muc#user">
|
||||
<item affiliation="none" jid="fabio@montefuscolo.com.br/Conversations.ZvLu" role="participant"/>
|
||||
</x>
|
||||
@ -862,7 +863,7 @@
|
||||
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
||||
expect(sizzle('div.chat-info', chat_content).length).toBe(5);
|
||||
expect(sizzle('div.chat-info:last', chat_content).pop().textContent).toBe(
|
||||
`fabio has entered the groupchat`);
|
||||
`fabio has entered the groupchat. "Ready for a new day"`);
|
||||
|
||||
// XXX: hack so that we can test leave/enter of occupants
|
||||
// who were already in the room when we joined.
|
||||
@ -905,14 +906,16 @@
|
||||
done();
|
||||
}));
|
||||
|
||||
it("doesn't show the disconnection status when muc_show_disconnection_status is false",
|
||||
it("doesn't show the disconnection status when muc_show_join_leave_status is false",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_show_disconnection_status': false},
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_show_join_leave_status': false},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.openChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1');
|
||||
await test_utils.openAndEnterChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1');
|
||||
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
|
||||
const chat_content = view.el.querySelector('.chat-content');
|
||||
expect(sizzle('div.chat-info', chat_content).pop().textContent).toBe('some1 has entered the groupchat');
|
||||
|
||||
let presence = $pres({
|
||||
to: 'dummy@localhost/resource',
|
||||
from: 'coven@chat.shakespeare.lit/newguy'
|
||||
@ -923,12 +926,13 @@
|
||||
'role': 'participant'
|
||||
});
|
||||
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
||||
expect(chat_content.querySelectorAll('div.chat-info').length).toBe(0);
|
||||
expect(chat_content.querySelectorAll('div.chat-info').length).toBe(2);
|
||||
expect(sizzle('div.chat-info', chat_content).pop().textContent).toBe('newguy has entered the groupchat');
|
||||
|
||||
presence = $pres({
|
||||
to: 'dummy@localhost/resource',
|
||||
type: 'unavailable',
|
||||
from: 'coven@chat.shakespeare.lit/newguy'
|
||||
type: 'unavailable',
|
||||
from: 'coven@chat.shakespeare.lit/newguy'
|
||||
})
|
||||
.c('status', 'Disconnected: Replaced by new connection').up()
|
||||
.c('x', {xmlns: Strophe.NS.MUC_USER})
|
||||
@ -938,8 +942,42 @@
|
||||
'role': 'none'
|
||||
});
|
||||
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
||||
expect(chat_content.querySelectorAll('div.chat-info').length).toBe(1);
|
||||
expect(sizzle('div.chat-info', chat_content).pop().textContent).toBe('newguy has left the groupchat');
|
||||
expect(chat_content.querySelectorAll('div.chat-info').length).toBe(2);
|
||||
expect(sizzle('div.chat-info', chat_content).pop().textContent).toBe('newguy has entered and left the groupchat');
|
||||
|
||||
presence = u.toStanza(
|
||||
`<presence xmlns="jabber:client" to="dummy@localhost/resource" from="coven@chat.shakespeare.lit/fabio">
|
||||
<c xmlns="http://jabber.org/protocol/caps" node="http://conversations.im" ver="INI3xjRUioclBTP/aACfWi5m9UY=" hash="sha-1"/>
|
||||
<status>Ready for a new day</status>
|
||||
<x xmlns="http://jabber.org/protocol/muc#user">
|
||||
<item affiliation="none" jid="fabio@montefuscolo.com.br/Conversations.ZvLu" role="participant"/>
|
||||
</x>
|
||||
</presence>`);
|
||||
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
||||
|
||||
expect(sizzle('div.chat-info:last', chat_content).pop().textContent).toBe(`fabio has entered the groupchat`);
|
||||
|
||||
presence = u.toStanza(
|
||||
`<presence xmlns="jabber:client" to="dummy@localhost/resource" from="coven@chat.shakespeare.lit/Dele Olajide">
|
||||
<x xmlns="http://jabber.org/protocol/muc#user">
|
||||
<item affiliation="none" jid="deleo@traderlynk.4ng.net/converse.js-39320524" role="participant"/>
|
||||
</x>
|
||||
</presence>`);
|
||||
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
||||
expect(sizzle('div.chat-info', chat_content).length).toBe(4);
|
||||
expect(sizzle('div.chat-info:last', chat_content).pop().textContent).toBe("Dele Olajide has entered the groupchat");
|
||||
await test_utils.sendMessage(view, 'hello world');
|
||||
|
||||
presence = u.toStanza(
|
||||
`<presence xmlns="jabber:client" to="dummy@localhost/resource" type="unavailable" from="coven@chat.shakespeare.lit/Dele Olajide">
|
||||
<status>Gotta go!</status>
|
||||
<x xmlns="http://jabber.org/protocol/muc#user">
|
||||
<item affiliation="none" jid="deleo@traderlynk.4ng.net/converse.js-74567907" role="none"/>
|
||||
</x>
|
||||
</presence>`);
|
||||
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
||||
expect(sizzle('div.chat-info', chat_content).length).toBe(5);
|
||||
expect(sizzle('div.chat-info:last', chat_content).pop().textContent).toBe(`Dele Olajide has left the groupchat`);
|
||||
done();
|
||||
}));
|
||||
|
||||
|
@ -117,8 +117,8 @@ converse.plugins.add('converse-muc-views', {
|
||||
'locked_muc_nickname': false,
|
||||
'muc_disable_slash_commands': false,
|
||||
'muc_domain': undefined,
|
||||
'muc_show_disconnection_status': true,
|
||||
'muc_show_join_leave': true,
|
||||
'muc_show_join_leave_status': true,
|
||||
'roomconfig_whitelist': [],
|
||||
'visible_toolbar_buttons': {
|
||||
'toggle_occupants': true
|
||||
@ -1597,7 +1597,7 @@ converse.plugins.add('converse-muc-views', {
|
||||
return;
|
||||
}
|
||||
const nick = occupant.get('nick'),
|
||||
stat = occupant.get('status'),
|
||||
stat = _converse.muc_show_join_leave_status ? occupant.get('status') : null,
|
||||
prev_info_el = this.getPreviousJoinOrLeaveNotification(this.content.lastElementChild, nick),
|
||||
data = _.get(prev_info_el, 'dataset', {});
|
||||
|
||||
@ -1652,7 +1652,7 @@ converse.plugins.add('converse-muc-views', {
|
||||
return;
|
||||
}
|
||||
const nick = occupant.get('nick'),
|
||||
stat = _converse.muc_show_disconnection_status ? occupant.get('status') : null,
|
||||
stat = _converse.muc_show_join_leave_status ? occupant.get('status') : null,
|
||||
prev_info_el = this.getPreviousJoinOrLeaveNotification(this.content.lastElementChild, nick),
|
||||
dataset = _.get(prev_info_el, 'dataset', {});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user