Fix incorrectly detecting every message with a duplicate ID as correction

This commit is contained in:
laszlovl 2019-09-16 12:49:18 +02:00 committed by JC Brand
parent 1a2de997b5
commit ab9b2d64ab
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,10 @@
# Changelog # Changelog
## 5.0.4
- Bugfix: Don't treat every duplicate message ID as a message correction; since some
clients don't use globally unique ID's this causes false positives.
## 5.0.3 (2019-09-13) ## 5.0.3 (2019-09-13)
- Emit `chatBoxFocused` and `chatBoxBlurred` events for emoji picker input - Emit `chatBoxFocused` and `chatBoxBlurred` events for emoji picker input

View File

@ -549,10 +549,10 @@ converse.plugins.add('converse-chatboxes', {
* {@link _converse.ChatBox.getMessageAttributesFromStanza} * {@link _converse.ChatBox.getMessageAttributesFromStanza}
*/ */
correctMessage (attrs) { correctMessage (attrs) {
if (!attrs.msgid || !attrs.from) { if (!attrs.replaced_id || !attrs.from) {
return; return;
} }
const message = this.messages.findWhere({'msgid': attrs.msgid, 'from': attrs.from}); const message = this.messages.findWhere({'msgid': attrs.replaced_id, 'from': attrs.from});
if (!message) { if (!message) {
return; return;
} }
@ -969,6 +969,7 @@ converse.plugins.add('converse-chatboxes', {
'is_spoiler': !!spoiler, 'is_spoiler': !!spoiler,
'message': text, 'message': text,
'msgid': msgid, 'msgid': msgid,
'replaced_id': replaced_id,
'references': this.getReferencesFromStanza(stanza), 'references': this.getReferencesFromStanza(stanza),
'subject': _.propertyOf(stanza.querySelector('subject'))('textContent'), 'subject': _.propertyOf(stanza.querySelector('subject'))('textContent'),
'thread': _.propertyOf(stanza.querySelector('thread'))('textContent'), 'thread': _.propertyOf(stanza.querySelector('thread'))('textContent'),