MUC: Set occupant ID from reflected message
This commit is contained in:
parent
ca3c8fc10b
commit
8ae4b6abd4
@ -1904,8 +1904,10 @@ const ChatRoomMixin = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getUpdatedMessageAttributes (message, attrs) {
|
getUpdatedMessageAttributes (message, attrs) {
|
||||||
const new_attrs = _converse.ChatBox.prototype.getUpdatedMessageAttributes.call(this, message, attrs);
|
const new_attrs = {
|
||||||
new_attrs['from_muc'] = attrs['from_muc'];
|
..._converse.ChatBox.prototype.getUpdatedMessageAttributes.call(this, message, attrs),
|
||||||
|
...pick(attrs, ['from_muc', 'occupant_id']),
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isOwnMessage(attrs)) {
|
if (this.isOwnMessage(attrs)) {
|
||||||
const stanza_id_keys = Object.keys(attrs).filter(k => k.startsWith('stanza_id'));
|
const stanza_id_keys = Object.keys(attrs).filter(k => k.startsWith('stanza_id'));
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/*global mock, converse */
|
/*global mock, converse */
|
||||||
|
|
||||||
const { Promise, $msg, $pres, sizzle } = converse.env;
|
const { Promise, Strophe, $msg, $pres, sizzle,u } = converse.env;
|
||||||
const u = converse.env.utils;
|
|
||||||
const original_timeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
const original_timeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||||
|
|
||||||
describe("A Groupchat Message", function () {
|
describe("A Groupchat Message", function () {
|
||||||
@ -275,8 +274,10 @@ describe("A Groupchat Message", function () {
|
|||||||
mock.initConverse([], {}, async function (_converse) {
|
mock.initConverse([], {}, async function (_converse) {
|
||||||
|
|
||||||
await mock.waitForRoster(_converse, 'current');
|
await mock.waitForRoster(_converse, 'current');
|
||||||
|
const nick = 'romeo';
|
||||||
const muc_jid = 'lounge@montague.lit';
|
const muc_jid = 'lounge@montague.lit';
|
||||||
await mock.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
const features = [...mock.default_muc_features, Strophe.NS.OCCUPANTID];
|
||||||
|
await mock.openAndEnterChatRoom(_converse, muc_jid, nick, features);
|
||||||
const view = _converse.chatboxviews.get(muc_jid);
|
const view = _converse.chatboxviews.get(muc_jid);
|
||||||
const textarea = await u.waitUntil(() => view.querySelector('.chat-textarea'));
|
const textarea = await u.waitUntil(() => view.querySelector('.chat-textarea'));
|
||||||
textarea.value = 'But soft, what light through yonder airlock breaks?';
|
textarea.value = 'But soft, what light through yonder airlock breaks?';
|
||||||
@ -299,6 +300,7 @@ describe("A Groupchat Message", function () {
|
|||||||
<stanza-id xmlns="urn:xmpp:sid:0"
|
<stanza-id xmlns="urn:xmpp:sid:0"
|
||||||
id="5f3dbc5e-e1d3-4077-a492-693f3769c7ad"
|
id="5f3dbc5e-e1d3-4077-a492-693f3769c7ad"
|
||||||
by="lounge@montague.lit"/>
|
by="lounge@montague.lit"/>
|
||||||
|
<occupant-id xmlns="urn:xmpp:occupant-id:0" id="dd72603deec90a38ba552f7c68cbcc61bca202cd" />
|
||||||
<origin-id xmlns="urn:xmpp:sid:0" id="${msg_obj.get('origin_id')}"/>
|
<origin-id xmlns="urn:xmpp:sid:0" id="${msg_obj.get('origin_id')}"/>
|
||||||
</message>`);
|
</message>`);
|
||||||
await view.model.handleMessageStanza(stanza);
|
await view.model.handleMessageStanza(stanza);
|
||||||
@ -310,6 +312,7 @@ describe("A Groupchat Message", function () {
|
|||||||
const message = view.model.messages.at(0);
|
const message = view.model.messages.at(0);
|
||||||
expect(message.get('stanza_id lounge@montague.lit')).toBe('5f3dbc5e-e1d3-4077-a492-693f3769c7ad');
|
expect(message.get('stanza_id lounge@montague.lit')).toBe('5f3dbc5e-e1d3-4077-a492-693f3769c7ad');
|
||||||
expect(message.get('origin_id')).toBe(msg_obj.get('origin_id'));
|
expect(message.get('origin_id')).toBe(msg_obj.get('origin_id'));
|
||||||
|
expect(message.get('occupant_id')).toBe('dd72603deec90a38ba552f7c68cbcc61bca202cd');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it("can cause a delivery receipt to be returned",
|
it("can cause a delivery receipt to be returned",
|
||||||
|
Loading…
Reference in New Issue
Block a user