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:
lilia 2017-01-22 20:26:10 -08:00
parent a623f909f2
commit 6253269d19

View file

@ -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) {