Insert inferred timer updates before the corresponding message
This commit is contained in:
parent
d52050d43f
commit
009098f8dd
2 changed files with 11 additions and 8 deletions
|
@ -179,17 +179,17 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addExpirationTimerUpdate: function(time, source) {
|
addExpirationTimerUpdate: function(expireTimer, source, received_at) {
|
||||||
var now = Date.now();
|
received_at = received_at || Date.now();
|
||||||
this.save({ expireTimer: time });
|
this.save({ expireTimer: expireTimer });
|
||||||
var message = this.messageCollection.add({
|
var message = this.messageCollection.add({
|
||||||
conversationId : this.id,
|
conversationId : this.id,
|
||||||
type : 'outgoing',
|
type : 'outgoing',
|
||||||
sent_at : now,
|
sent_at : received_at,
|
||||||
received_at : now,
|
received_at : received_at,
|
||||||
flags : textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
flags : textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
||||||
expirationTimerUpdate : {
|
expirationTimerUpdate : {
|
||||||
expireTimer : time,
|
expireTimer : expireTimer,
|
||||||
source : source
|
source : source
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -376,10 +376,13 @@
|
||||||
}
|
}
|
||||||
if (dataMessage.expireTimer) {
|
if (dataMessage.expireTimer) {
|
||||||
if (dataMessage.expireTimer !== conversation.get('expireTimer')) {
|
if (dataMessage.expireTimer !== conversation.get('expireTimer')) {
|
||||||
conversation.addExpirationTimerUpdate(dataMessage.expireTimer, source);
|
conversation.addExpirationTimerUpdate(
|
||||||
|
dataMessage.expireTimer, source,
|
||||||
|
message.get('received_at'));
|
||||||
}
|
}
|
||||||
} else if (conversation.get('expireTimer')) {
|
} else if (conversation.get('expireTimer')) {
|
||||||
conversation.addExpirationTimerUpdate(0, source);
|
conversation.addExpirationTimerUpdate(0, source,
|
||||||
|
message.get('received_at'));
|
||||||
}
|
}
|
||||||
|
|
||||||
var conversation_timestamp = conversation.get('timestamp');
|
var conversation_timestamp = conversation.get('timestamp');
|
||||||
|
|
Loading…
Reference in a new issue