Commit dbcf6002 authored by JC Brand's avatar JC Brand

Fixes #1442

parent 84e0ce66
......@@ -5,15 +5,16 @@
- Updated translations: af, cz, de, es, eu, ga, he, hi, ja, nb, nl_BE, zh_CN
- New language supported: Esperanto
- Accessibility: Tag the chat-content as an ARIA live region, for screen readers
- Set releases URL to new Github repo
- #1369 Don't wrongly interpret message with `subject` as a topic change.
- #1408 new config option `roomconfig_whitelist`
- #1417 Margin between nickname and badge
- #1421 fix direct invite for membersonly room
- #1422 Resurrect the `muc_show_join_leave` option
- #1412 muc moderator commands can be disabled selectively by config
- #1413 fix moderator commands that change affiliation
- #1414 Prevent duplicate messages on MUC join
- Update releases url
- #1417 Margin between nickname and badge
- #1421 fix direct invite for membersonly room
- #1422 Resurrect the `muc_show_join_leave` option
- #1442 MUC read receipts causing empty lines
## 4.1.0 (2019-01-11)
......
......@@ -66987,6 +66987,14 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
}
},
isReceipt(stanza) {
return sizzle(`[xmlns="${Strophe.NS.RECEIPTS}"]`, stanza).length > 0;
},
isChatMarker(stanza) {
return sizzle(`[xmlns="${Strophe.NS.MARKERS}"]`, stanza).length > 0;
},
async onMessage(stanza) {
/* Handler for all MUC messages sent to this groupchat.
*
......@@ -67011,7 +67019,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
return;
}
if (!this.handleMessageCorrection(stanza)) {
if (!this.handleMessageCorrection(stanza) && !this.isReceipt(stanza) && !this.isChatMarker(stanza)) {
if (attrs.subject && !attrs.thread && !attrs.message) {
// https://xmpp.org/extensions/xep-0045.html#subject-mod
// -----------------------------------------------------
......@@ -2316,7 +2316,7 @@
done();
}));
it("delivery can be acknowledged by a receipt",
it("will be shown as received upon MUC reflection",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async function (done, _converse) {
......@@ -2347,6 +2347,40 @@
done();
}));
it("can cause a delivery receipt",
mock.initConverse(
null, ['rosterGroupsFetched'], {},
async function (done, _converse) {
test_utils.createContacts(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'localhost', 'dummy');
const view = _converse.chatboxviews.get('lounge@localhost');
const textarea = view.el.querySelector('textarea.chat-textarea');
textarea.value = 'But soft, what light through yonder airlock breaks?';
view.keyPressed({
target: textarea,
preventDefault: _.noop,
keyCode: 13 // Enter
});
await new Promise((resolve, reject) => view.once('messageInserted', resolve));
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
const msg_obj = view.model.messages.at(0);
const stanza = u.toStanza(`
<message xml:lang="en" to="dummy@localhost/resource"
from="lounge@localhost/some1" type="groupchat" xmlns="jabber:client">
<received xmlns="urn:xmpp:receipts" id="${msg_obj.get('msgid')}"/>
<origin-id xmlns="urn:xmpp:sid:0" id="CE08D448-5ED8-4B6A-BB5B-07ED9DFE4FF0"/>
</message>`);
spyOn(_converse, 'emit').and.callThrough();
_converse.connection._dataRecv(test_utils.createRequest(stanza));
await test_utils.waitUntil(() => _converse.emit.calls.count() === 1);
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
expect(view.el.querySelectorAll('.chat-msg__receipt').length).toBe(0);
expect(_converse.emit).toHaveBeenCalledWith('message', jasmine.any(Object));
done();
}));
describe("when received", function () {
it("highlights all users mentioned via XEP-0372 references",
......
......@@ -978,6 +978,14 @@ converse.plugins.add('converse-muc', {
}
},
isReceipt (stanza) {
return sizzle(`[xmlns="${Strophe.NS.RECEIPTS}"]`, stanza).length > 0;
},
isChatMarker (stanza) {
return sizzle(`[xmlns="${Strophe.NS.MARKERS}"]`, stanza).length > 0;
},
async onMessage (stanza) {
/* Handler for all MUC messages sent to this groupchat.
*
......@@ -998,7 +1006,10 @@ converse.plugins.add('converse-muc', {
if (!attrs.nick) {
return;
}
if (!this.handleMessageCorrection(stanza)) {
if (!this.handleMessageCorrection(stanza) &&
!this.isReceipt(stanza) &&
!this.isChatMarker(stanza)) {
if (attrs.subject && !attrs.thread && !attrs.message) {
// https://xmpp.org/extensions/xep-0045.html#subject-mod
// -----------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment