Add 'newmessage' event handler to Conversation for reliablity
This commit is contained in:
@@ -108,6 +108,7 @@
|
|||||||
this.on('change:profileKey', this.onChangeProfileKey);
|
this.on('change:profileKey', this.onChangeProfileKey);
|
||||||
this.on('destroy', this.revokeAvatarUrl);
|
this.on('destroy', this.revokeAvatarUrl);
|
||||||
|
|
||||||
|
this.on('newmessage', this.addSingleMessage);
|
||||||
this.on('expired', this.onExpired);
|
this.on('expired', this.onExpired);
|
||||||
this.listenTo(
|
this.listenTo(
|
||||||
this.messageCollection,
|
this.messageCollection,
|
||||||
@@ -145,6 +146,7 @@
|
|||||||
|
|
||||||
addSingleMessage(message) {
|
addSingleMessage(message) {
|
||||||
const model = this.messageCollection.add(message, { merge: true });
|
const model = this.messageCollection.add(message, { merge: true });
|
||||||
|
model.setToExpire();
|
||||||
this.processQuotes(this.messageCollection);
|
this.processQuotes(this.messageCollection);
|
||||||
return model;
|
return model;
|
||||||
},
|
},
|
||||||
|
@@ -805,9 +805,6 @@
|
|||||||
// This is debounced, so it won't hit the database too often.
|
// This is debounced, so it won't hit the database too often.
|
||||||
this.lazyUpdateVerified();
|
this.lazyUpdateVerified();
|
||||||
|
|
||||||
this.model.addSingleMessage(message);
|
|
||||||
message.setToExpire();
|
|
||||||
|
|
||||||
if (message.isOutgoing()) {
|
if (message.isOutgoing()) {
|
||||||
this.removeLastSeenIndicator();
|
this.removeLastSeenIndicator();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user