Message deduplication bugfixes and improvements.
- Add a new method to check for dupes based on the message text. - When checking for dupes based on origin_id, no need to restrict to only our own.
This commit is contained in:
parent
7feab35a1d
commit
b9e5658112
@ -8,6 +8,7 @@
|
|||||||
- Hide the textarea when a user is muted in a groupchat.
|
- Hide the textarea when a user is muted in a groupchat.
|
||||||
- Don't restore a BOSH session without knowing the JID
|
- Don't restore a BOSH session without knowing the JID
|
||||||
- In the `/help` menu, only show allowed commands
|
- In the `/help` menu, only show allowed commands
|
||||||
|
- Message deduplication bugfixes and improvements
|
||||||
- #1296: `embedded` view mode shows `chatbox-navback` arrow in header
|
- #1296: `embedded` view mode shows `chatbox-navback` arrow in header
|
||||||
- #1532: Converse reloads on enter pressed in the filter box
|
- #1532: Converse reloads on enter pressed in the filter box
|
||||||
|
|
||||||
|
26
dist/converse.js
vendored
26
dist/converse.js
vendored
@ -62423,8 +62423,8 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDuplicateMessage(stanza) {
|
async getDuplicateMessage(stanza) {
|
||||||
return this.findDuplicateFromOriginID(stanza) || this.findDuplicateFromStanzaID(stanza);
|
return this.findDuplicateFromOriginID(stanza) || (await this.findDuplicateFromStanzaID(stanza)) || this.findDuplicateFromMessage(stanza);
|
||||||
},
|
},
|
||||||
|
|
||||||
findDuplicateFromOriginID(stanza) {
|
findDuplicateFromOriginID(stanza) {
|
||||||
@ -62436,7 +62436,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
|
|||||||
|
|
||||||
return this.messages.findWhere({
|
return this.messages.findWhere({
|
||||||
'origin_id': origin_id.getAttribute('id'),
|
'origin_id': origin_id.getAttribute('id'),
|
||||||
'sender': 'me'
|
'from': stanza.getAttribute('from')
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -62459,6 +62459,26 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
|
|||||||
return this.messages.findWhere(query);
|
return this.messages.findWhere(query);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
findDuplicateFromMessage(stanza) {
|
||||||
|
const text = this.getMessageBody(stanza) || undefined;
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = stanza.getAttribute('id');
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.messages.findWhere({
|
||||||
|
'message': text,
|
||||||
|
'from': stanza.getAttribute('from'),
|
||||||
|
'msgid': id
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
sendMarker(to_jid, id, type) {
|
sendMarker(to_jid, id, type) {
|
||||||
const stanza = $msg({
|
const stanza = $msg({
|
||||||
'from': _converse.connection.jid,
|
'from': _converse.connection.jid,
|
||||||
|
@ -2249,7 +2249,6 @@
|
|||||||
<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="room@muc.example.com"/>
|
by="room@muc.example.com"/>
|
||||||
<origin-id xmlns="urn:xmpp:sid:0" id="de305d54-75b4-431b-adb2-eb6b9e546013"/>
|
|
||||||
</message>`);
|
</message>`);
|
||||||
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
||||||
await test_utils.waitUntil(() => _converse.api.chats.get().length);
|
await test_utils.waitUntil(() => _converse.api.chats.get().length);
|
||||||
@ -2267,7 +2266,6 @@
|
|||||||
<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="room@muc.example.com"/>
|
by="room@muc.example.com"/>
|
||||||
<origin-id xmlns="urn:xmpp:sid:0" id="de305d54-75b4-431b-adb2-eb6b9e546013"/>
|
|
||||||
</message>`);
|
</message>`);
|
||||||
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
_converse.connection._dataRecv(test_utils.createRequest(stanza));
|
||||||
await test_utils.waitUntil(() => view.model.findDuplicateFromStanzaID.calls.count() === 2);
|
await test_utils.waitUntil(() => view.model.findDuplicateFromStanzaID.calls.count() === 2);
|
||||||
|
@ -360,8 +360,10 @@ converse.plugins.add('converse-chatboxes', {
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDuplicateMessage (stanza) {
|
async getDuplicateMessage (stanza) {
|
||||||
return this.findDuplicateFromOriginID(stanza) || this.findDuplicateFromStanzaID(stanza);
|
return this.findDuplicateFromOriginID(stanza) ||
|
||||||
|
await this.findDuplicateFromStanzaID(stanza) ||
|
||||||
|
this.findDuplicateFromMessage(stanza);
|
||||||
},
|
},
|
||||||
|
|
||||||
findDuplicateFromOriginID (stanza) {
|
findDuplicateFromOriginID (stanza) {
|
||||||
@ -371,7 +373,7 @@ converse.plugins.add('converse-chatboxes', {
|
|||||||
}
|
}
|
||||||
return this.messages.findWhere({
|
return this.messages.findWhere({
|
||||||
'origin_id': origin_id.getAttribute('id'),
|
'origin_id': origin_id.getAttribute('id'),
|
||||||
'sender': 'me'
|
'from': stanza.getAttribute('from')
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -390,6 +392,17 @@ converse.plugins.add('converse-chatboxes', {
|
|||||||
return this.messages.findWhere(query);
|
return this.messages.findWhere(query);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
findDuplicateFromMessage (stanza) {
|
||||||
|
const text = this.getMessageBody(stanza) || undefined;
|
||||||
|
if (!text) { return false; }
|
||||||
|
const id = stanza.getAttribute('id');
|
||||||
|
if (!id) { return false; }
|
||||||
|
return this.messages.findWhere({
|
||||||
|
'message': text,
|
||||||
|
'from': stanza.getAttribute('from'),
|
||||||
|
'msgid': id
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
sendMarker(to_jid, id, type) {
|
sendMarker(to_jid, id, type) {
|
||||||
const stanza = $msg({
|
const stanza = $msg({
|
||||||
|
@ -323,6 +323,7 @@ converse.plugins.add('converse-muc', {
|
|||||||
'to': this.getRoomJIDAndNick(nick)
|
'to': this.getRoomJIDAndNick(nick)
|
||||||
}).c("x", {'xmlns': Strophe.NS.MUC})
|
}).c("x", {'xmlns': Strophe.NS.MUC})
|
||||||
.c("history", {'maxstanzas': this.features.get('mam_enabled') ? 0 : _converse.muc_history_max_stanzas}).up();
|
.c("history", {'maxstanzas': this.features.get('mam_enabled') ? 0 : _converse.muc_history_max_stanzas}).up();
|
||||||
|
|
||||||
if (password) {
|
if (password) {
|
||||||
stanza.cnode(Strophe.xmlElement("password", [], password));
|
stanza.cnode(Strophe.xmlElement("password", [], password));
|
||||||
}
|
}
|
||||||
@ -1082,6 +1083,7 @@ converse.plugins.add('converse-muc', {
|
|||||||
return _converse.api.trigger('message', {'stanza': original_stanza});
|
return _converse.api.trigger('message', {'stanza': original_stanza});
|
||||||
}
|
}
|
||||||
const attrs = await this.getMessageAttributesFromStanza(stanza, original_stanza);
|
const attrs = await this.getMessageAttributesFromStanza(stanza, original_stanza);
|
||||||
|
|
||||||
if (attrs.nick &&
|
if (attrs.nick &&
|
||||||
!this.subjectChangeHandled(attrs) &&
|
!this.subjectChangeHandled(attrs) &&
|
||||||
!this.ignorableCSN(attrs) &&
|
!this.ignorableCSN(attrs) &&
|
||||||
|
26
src/headless/dist/converse-headless.js
vendored
26
src/headless/dist/converse-headless.js
vendored
@ -40647,8 +40647,8 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDuplicateMessage(stanza) {
|
async getDuplicateMessage(stanza) {
|
||||||
return this.findDuplicateFromOriginID(stanza) || this.findDuplicateFromStanzaID(stanza);
|
return this.findDuplicateFromOriginID(stanza) || (await this.findDuplicateFromStanzaID(stanza)) || this.findDuplicateFromMessage(stanza);
|
||||||
},
|
},
|
||||||
|
|
||||||
findDuplicateFromOriginID(stanza) {
|
findDuplicateFromOriginID(stanza) {
|
||||||
@ -40660,7 +40660,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
|
|||||||
|
|
||||||
return this.messages.findWhere({
|
return this.messages.findWhere({
|
||||||
'origin_id': origin_id.getAttribute('id'),
|
'origin_id': origin_id.getAttribute('id'),
|
||||||
'sender': 'me'
|
'from': stanza.getAttribute('from')
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -40683,6 +40683,26 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
|
|||||||
return this.messages.findWhere(query);
|
return this.messages.findWhere(query);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
findDuplicateFromMessage(stanza) {
|
||||||
|
const text = this.getMessageBody(stanza) || undefined;
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = stanza.getAttribute('id');
|
||||||
|
|
||||||
|
if (!id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.messages.findWhere({
|
||||||
|
'message': text,
|
||||||
|
'from': stanza.getAttribute('from'),
|
||||||
|
'msgid': id
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
sendMarker(to_jid, id, type) {
|
sendMarker(to_jid, id, type) {
|
||||||
const stanza = $msg({
|
const stanza = $msg({
|
||||||
'from': _converse.connection.jid,
|
'from': _converse.connection.jid,
|
||||||
|
Loading…
Reference in New Issue
Block a user