mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-25 04:36:46 +00:00
Set receivedAt after decrypt, sort by received then sent
FREEBIE
This commit is contained in:
@@ -589,7 +589,13 @@
|
||||
model : Message,
|
||||
database : Whisper.Database,
|
||||
storeName : 'messages',
|
||||
comparator : 'received_at',
|
||||
comparator : function(left, right) {
|
||||
if (left.get('received_at') === right.get('received_at')) {
|
||||
return (left.get('sent_at') || 0) - (right.get('sent_at') || 0);
|
||||
}
|
||||
|
||||
return (left.get('received_at') || 0) - (right.get('received_at') || 0);
|
||||
},
|
||||
initialize : function(models, options) {
|
||||
if (options) {
|
||||
this.conversation = options.conversation;
|
||||
|
||||
@@ -81,7 +81,6 @@ MessageReceiver.prototype.extend({
|
||||
}
|
||||
return;
|
||||
}
|
||||
var receivedAt = Date.now();
|
||||
|
||||
this.incoming.push(textsecure.crypto.decryptWebsocketMessage(request.body, this.signalingKey).then(function(plaintext) {
|
||||
var envelope = textsecure.protobuf.Envelope.decode(plaintext);
|
||||
@@ -93,8 +92,6 @@ MessageReceiver.prototype.extend({
|
||||
return request.respond(200, 'OK');
|
||||
}
|
||||
|
||||
envelope.receivedAt = receivedAt;
|
||||
|
||||
return this.addToCache(envelope, plaintext).then(function() {
|
||||
request.respond(200, 'OK');
|
||||
this.queueEnvelope(envelope);
|
||||
|
||||
Reference in New Issue
Block a user