MUC: Bugfix, don't set state to entered on unavailable presence

This commit is contained in:
JC Brand 2020-12-16 17:23:30 +01:00
parent 594332181b
commit 18e6ebe9af
2 changed files with 7 additions and 2 deletions

View File

@ -2713,7 +2713,10 @@ describe("Groupchats", function () {
* </presence>
*/
await mock.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
var presence = $pres().attrs({
const view = _converse.chatboxviews.get('lounge@montague.lit');
expect(view.model.session.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED);
const presence = $pres().attrs({
from:'lounge@montague.lit/romeo',
to:'romeo@montague.lit/pda',
type:'unavailable'
@ -2732,7 +2735,6 @@ describe("Groupchats", function () {
_converse.connection._dataRecv(mock.createRequest(presence));
const view = _converse.chatboxviews.get('lounge@montague.lit');
expect(u.isVisible(view.el.querySelector('.chat-area'))).toBeFalsy();
expect(u.isVisible(view.el.querySelector('.occupants'))).toBeFalsy();
const chat_body = view.el.querySelector('.chatroom-body');
@ -2743,6 +2745,8 @@ describe("Groupchats", function () {
'This action was done by Fluellen.');
expect(chat_body.querySelector('.disconnect-msg:nth-child(3)').textContent.trim()).toBe(
'The reason given is: "Avaunt, you cullion!".');
expect(view.model.session.get('connection_status')).toBe(converse.ROOMSTATUS.DISCONNECTED);
done();
}));

View File

@ -2254,6 +2254,7 @@ const ChatRoomMixin = {
if (stanza.getAttribute('type') === 'unavailable') {
this.handleDisconnection(stanza);
return;
} else {
const locked_room = stanza.querySelector("status[code='201']");
if (locked_room) {