Tweak key change advisory insertion
Let received_at be the current time for keychanges. This avoids them being inserted in the wrong place in the thread. Use the newmessage event to trigger frontend listeners to add them to the conversation view if it is open.
This commit is contained in:
parent
a623f909f2
commit
6253269d19
1 changed files with 5 additions and 3 deletions
|
@ -51,14 +51,16 @@
|
|||
},
|
||||
|
||||
addKeyChange: function(id) {
|
||||
var message = this.messageCollection.add({
|
||||
var timestamp = Date.now();
|
||||
var message = new Whisper.Message({
|
||||
conversationId : this.id,
|
||||
type : 'keychange',
|
||||
sent_at : this.get('timestamp'),
|
||||
received_at : this.get('timestamp'),
|
||||
received_at : timestamp,
|
||||
key_changed : id
|
||||
});
|
||||
message.save();
|
||||
this.set({ lastMessage: message.getNotificationText() });
|
||||
message.save().then(this.trigger.bind(this,'newmessage', message));
|
||||
},
|
||||
|
||||
onReadMessage: function(message) {
|
||||
|
|
Loading…
Reference in a new issue