Ensure timer updates show in convo before initiating message
This commit is contained in:
parent
7cebeb20f5
commit
dfa1f0797c
2 changed files with 16 additions and 2 deletions
|
@ -878,11 +878,17 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
source = source || textsecure.storage.user.getNumber();
|
source = source || textsecure.storage.user.getNumber();
|
||||||
const timestamp = receivedAt || Date.now();
|
|
||||||
|
// When we add a disappearing messages notification to the conversation, we want it
|
||||||
|
// to be above the message that initiated that change, hence the subtraction.
|
||||||
|
const timestamp = (receivedAt || Date.now()) - 1;
|
||||||
|
|
||||||
const message = this.messageCollection.add({
|
const message = this.messageCollection.add({
|
||||||
|
// Even though this isn't reflected to the user, we want to place the last seen
|
||||||
|
// indicator above it. We set it to 'unread' to trigger that placement.
|
||||||
|
unread: 1,
|
||||||
conversationId: this.id,
|
conversationId: this.id,
|
||||||
type: receivedAt ? 'incoming' : 'outgoing',
|
// No type; 'incoming' messages are specially treated by conversation.markRead()
|
||||||
sent_at: timestamp,
|
sent_at: timestamp,
|
||||||
received_at: timestamp,
|
received_at: timestamp,
|
||||||
flags: textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
flags: textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
||||||
|
|
|
@ -94,6 +94,7 @@
|
||||||
this.conversation = this.model.getExpirationTimerUpdateSource();
|
this.conversation = this.model.getExpirationTimerUpdateSource();
|
||||||
this.listenTo(this.conversation, 'change', this.render);
|
this.listenTo(this.conversation, 'change', this.render);
|
||||||
this.listenTo(this.model, 'unload', this.remove);
|
this.listenTo(this.model, 'unload', this.remove);
|
||||||
|
this.listenTo(this.model, 'change', this.onChange);
|
||||||
},
|
},
|
||||||
render_attributes() {
|
render_attributes() {
|
||||||
const seconds = this.model.get('expirationTimerUpdate').expireTimer;
|
const seconds = this.model.get('expirationTimerUpdate').expireTimer;
|
||||||
|
@ -114,6 +115,13 @@
|
||||||
}
|
}
|
||||||
return { content: timerMessage };
|
return { content: timerMessage };
|
||||||
},
|
},
|
||||||
|
onChange() {
|
||||||
|
this.addId();
|
||||||
|
},
|
||||||
|
addId() {
|
||||||
|
// This is important to enable the lastSeenIndicator when it's just been added.
|
||||||
|
this.$el.attr('id', this.id());
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Whisper.KeyChangeView = Whisper.View.extend({
|
Whisper.KeyChangeView = Whisper.View.extend({
|
||||||
|
|
Loading…
Add table
Reference in a new issue