Sync messages: Additional debugging info, consistent ids

This commit is contained in:
Scott Nonnenberg 2020-08-06 10:28:56 -07:00 committed by GitHub
parent 1227a51c99
commit b63291507a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 20 deletions

View file

@ -13,8 +13,12 @@
window.Whisper = window.Whisper || {};
Whisper.ReadSyncs = new (Backbone.Collection.extend({
forMessage(message) {
const senderId = window.ConversationController.ensureContactIds({
e164: message.get('source'),
uuid: message.get('sourceUuid'),
});
const receipt = this.findWhere({
sender: message.get('source'),
senderId,
timestamp: message.get('sent_at'),
});
if (receipt) {
@ -34,12 +38,14 @@
}
);
const found = messages.find(
item =>
item.isIncoming() &&
(item.get('source') === receipt.get('sender') ||
item.get('sourceUuid') === receipt.get('senderUuid'))
);
const found = messages.find(item => {
const senderId = window.ConversationController.ensureContactIds({
e164: item.get('source'),
uuid: item.get('sourceUuid'),
});
return item.isIncoming() && senderId === receipt.get('senderId');
});
const notificationForMessage = found
? Whisper.Notifications.findWhere({ messageId: found.id })
: null;
@ -48,6 +54,7 @@
if (!found) {
window.log.info(
'No message for read sync',
receipt.get('senderId'),
receipt.get('sender'),
receipt.get('senderUuid'),
receipt.get('timestamp')