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.
pull/749/head
lilia 8 years ago
parent a623f909f2
commit 6253269d19

@ -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…
Cancel
Save