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) {
|
||||
var now = Date.now();
|
||||
this.save({ expireTimer: time });
|
||||
addExpirationTimerUpdate: function(expireTimer, source, received_at) {
|
||||
received_at = received_at || Date.now();
|
||||
this.save({ expireTimer: expireTimer });
|
||||
var message = this.messageCollection.add({
|
||||
conversationId : this.id,
|
||||
type : 'outgoing',
|
||||
sent_at : now,
|
||||
received_at : now,
|
||||
sent_at : received_at,
|
||||
received_at : received_at,
|
||||
flags : textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
||||
expirationTimerUpdate : {
|
||||
expireTimer : time,
|
||||
expireTimer : expireTimer,
|
||||
source : source
|
||||
}
|
||||
});
|
||||
|
|
|
@ -376,10 +376,13 @@
|
|||
}
|
||||
if (dataMessage.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')) {
|
||||
conversation.addExpirationTimerUpdate(0, source);
|
||||
conversation.addExpirationTimerUpdate(0, source,
|
||||
message.get('received_at'));
|
||||
}
|
||||
|
||||
var conversation_timestamp = conversation.get('timestamp');
|
||||
|
|
Loading…
Reference in a new issue