Use sizzle, otherwise we sometimes get null returned.
This commit is contained in:
JC Brand 2018-03-02 12:36:08 +01:00
parent 860befcab9
commit 34ac7e99ab
3 changed files with 15 additions and 11 deletions

View File

@ -3,11 +3,16 @@
## 3.3.4 (Unreleased)
- Avoid `eval` (via `_.template` from lodash).
- Bugfix. Avatars weren't being shown.
- Bugfix. Bookmarks list and open rooms list weren't recreated after logging in for a 2nd time (without reloading the browser).
- Don't show bookmark toggles when PEP bookmarking not supported by the XMPP server.
- Add LibreJS support
### Bugfixes
- Avatars weren't being shown.
- Bookmarks list and open rooms list weren't recreated after logging in for a 2nd time (without reloading the browser).
- #1024 null reference on MUC Invite
- #1025 OTR lock icon disappears
## 3.3.3 (2018-02-14)
### Bugfixes

View File

@ -1423,16 +1423,15 @@
var from_jid = name.replace(/ /g,'.').toLowerCase() + '@localhost';
var room_jid = 'lounge@localhost';
var reason = "Please join this chat room";
var message = $(
"<message from='"+from_jid+"' to='"+_converse.bare_jid+"'>" +
"<x xmlns='jabber:x:conference'" +
"jid='"+room_jid+"'" +
"reason='"+reason+"'/>"+
"</message>"
)[0];
expect(_converse.chatboxes.models.length).toBe(1);
expect(_converse.chatboxes.models[0].id).toBe("controlbox");
_converse.onDirectMUCInvitation(message);
var stanza = Strophe.xmlHtmlNode(
'<message xmlns="jabber:client" to="'+_converse.bare_jid+'" from="'+from_jid+'" id="9bceb415-f34b-4fa4-80d5-c0d076a24231">'+
'<x xmlns="jabber:x:conference" jid="'+room_jid+'" reason="'+reason+'"/>'+
'</message>').firstChild;
_converse.onDirectMUCInvitation(stanza);
expect(window.confirm).toHaveBeenCalledWith(
name + ' has invited you to join a chat room: '+ room_jid +
', and left the following reason: "'+reason+'"');

View File

@ -2839,7 +2839,7 @@
* (XMLElement) message: The message stanza containing the
* invitation.
*/
const x_el = message.querySelector('x[xmlns="jabber:x:conference"]'),
const x_el = sizzle('x[xmlns="jabber:x:conference"]', message).pop(),
from = Strophe.getBareJidFromJid(message.getAttribute('from')),
room_jid = x_el.getAttribute('jid'),
reason = x_el.getAttribute('reason');