Log read sync reception and remove notification
This commit is contained in:
parent
d434262540
commit
24002149f6
1 changed files with 26 additions and 15 deletions
|
@ -24,21 +24,32 @@
|
||||||
message.get('source') === receipt.get('sender')
|
message.get('source') === receipt.get('sender')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (message) {
|
const notificationForMessage = message
|
||||||
Whisper.Notifications.remove(message);
|
? Whisper.Notifications.findWhere({ messageId: message.id })
|
||||||
return message.markRead(receipt.get('read_at')).then(
|
: null;
|
||||||
function() {
|
const removedNotification = Whisper.Notifications.remove(
|
||||||
this.notifyConversation(message);
|
notificationForMessage
|
||||||
this.remove(receipt);
|
);
|
||||||
}.bind(this)
|
const receiptSender = receipt.get('sender');
|
||||||
);
|
const receiptTimestamp = receipt.get('timestamp');
|
||||||
} else {
|
const wasMessageFound = Boolean(message);
|
||||||
console.log(
|
const wasNotificationFound = Boolean(notificationForMessage);
|
||||||
'No message for read sync',
|
const wasNotificationRemoved = Boolean(removedNotification);
|
||||||
receipt.get('sender'),
|
console.log('Receive read sync:', {
|
||||||
receipt.get('timestamp')
|
receiptSender,
|
||||||
);
|
receiptTimestamp,
|
||||||
}
|
wasMessageFound,
|
||||||
|
wasNotificationFound,
|
||||||
|
wasNotificationRemoved,
|
||||||
|
});
|
||||||
|
return message
|
||||||
|
? message.markRead(receipt.get('read_at')).then(
|
||||||
|
function() {
|
||||||
|
this.notifyConversation(message);
|
||||||
|
this.remove(receipt);
|
||||||
|
}.bind(this)
|
||||||
|
)
|
||||||
|
: Promise.resolve();
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue