diff --git a/CHANGES.md b/CHANGES.md index b4ab2516a..ac957ed63 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ - #1083: Add support for XEP-0393 Message Styling - #2275: Allow punctuation to immediately precede a mention - Add support for XEP-0437 Room Activity Indicators see [muc-subscribe-to-rai](https://conversejs.org/docs/html/configuration.html#muc-subscribe-to-rai) +- Bugfix: Use real JID in XEP-0372 references only when the MUC is non-anonymous - Bugfix: Connection protocol not updated based on XEP-0156 connection methods - Bugfix: `null` inserted by emoji picker and can't switch between skintones - New hook: [getMessageActionButtons](https://conversejs.org/docs/html/api/-_converse.html#event:getMessageActionButtons) diff --git a/spec/mentions.js b/spec/mentions.js index 4c09b5ac0..9f1d33e7b 100644 --- a/spec/mentions.js +++ b/spec/mentions.js @@ -138,7 +138,21 @@ describe("A sent groupchat message", function () { async function (done, _converse) { const muc_jid = 'lounge@montague.lit'; - await mock.openAndEnterChatRoom(_converse, muc_jid, 'tom'); + + // Making the MUC non-anonymous so that real JIDs are included + const features = [ + 'http://jabber.org/protocol/muc', + 'jabber:iq:register', + Strophe.NS.SID, + Strophe.NS.MAM, + 'muc_passwordprotected', + 'muc_hidden', + 'muc_temporary', + 'muc_open', + 'muc_unmoderated', + 'muc_nonanonymous' + ]; + await mock.openAndEnterChatRoom(_converse, muc_jid, 'tom', features); const view = _converse.api.chatviews.get(muc_jid); ['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh', 'Link Mauve', 'robot'].forEach((nick) => { _converse.connection._dataRecv(mock.createRequest( @@ -334,7 +348,21 @@ describe("A sent groupchat message", function () { async function (done, _converse) { const muc_jid = 'lounge@montague.lit'; - await mock.openAndEnterChatRoom(_converse, muc_jid, 'tom'); + + // Making the MUC non-anonymous so that real JIDs are included + const features = [ + 'http://jabber.org/protocol/muc', + 'jabber:iq:register', + Strophe.NS.SID, + Strophe.NS.MAM, + 'muc_passwordprotected', + 'muc_hidden', + 'muc_temporary', + 'muc_open', + 'muc_unmoderated', + 'muc_nonanonymous' + ]; + await mock.openAndEnterChatRoom(_converse, muc_jid, 'tom', features); const view = _converse.api.chatviews.get(muc_jid); ['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => { _converse.connection._dataRecv(mock.createRequest( @@ -455,9 +483,9 @@ describe("A sent groupchat message", function () { `xmlns="jabber:client">`+ `hello z3r0 gibson mr.robot, how are you?`+ ``+ - ``+ - ``+ - ``+ + ``+ + ``+ + ``+ ``+ ``); done(); diff --git a/src/headless/plugins/muc/muc.js b/src/headless/plugins/muc/muc.js index a65d03e2d..53f46009f 100644 --- a/src/headless/plugins/muc/muc.js +++ b/src/headless/plugins/muc/muc.js @@ -868,7 +868,7 @@ const ChatRoomMixin = { const uriFromNickname = nickname => { const jid = this.get('jid'); const occupant = this.getOccupant(nickname) || this.getOccupant(jid); - const uri = (occupant && occupant.get('jid')) || `${jid}/${nickname}`; + const uri = (this.features.get('nonanonymous') && occupant?.get('jid')) || `${jid}/${nickname}`; return encodeURI(`xmpp:${uri}`); }; diff --git a/webpack.common.js b/webpack.common.js index 969ec57b3..c2d97c66d 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -78,7 +78,7 @@ module.exports = { presets: [ ["@babel/preset-env", { "targets": { - "browsers": [">1%", "not ie 11", "not op_mini all"] + "browsers": [">1%", "not ie 11", "not op_mini all", "not dead"] } }] ],