Set receivedAt after decrypt, sort by received then sent
FREEBIE
This commit is contained in:
parent
4c7b174606
commit
7e9ed1481b
2 changed files with 7 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue