Auto healing unreferenced quotes
This commit is contained in:
parent
3cc6c5f5ad
commit
c313514f34
1 changed files with 30 additions and 1 deletions
|
@ -1135,6 +1135,35 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
);
|
);
|
||||||
const authorColor = contact ? contact.getColor() : 'grey';
|
const authorColor = contact ? contact.getColor() : 'grey';
|
||||||
|
|
||||||
|
let reallyNotFound = referencedMessageNotFound;
|
||||||
|
// Is the quote really without a reference? Check with our in memory store
|
||||||
|
// first to make sure it's not there.
|
||||||
|
if (referencedMessageNotFound) {
|
||||||
|
const messageId = this.get('sent_at');
|
||||||
|
window.log.info(
|
||||||
|
`getPropsForQuote: Verifying that ${messageId} referencing ${sentAt} is really not found`
|
||||||
|
);
|
||||||
|
const inMemoryMessage = window.MessageController.findBySentAt(
|
||||||
|
Number(sentAt)
|
||||||
|
);
|
||||||
|
reallyNotFound = !inMemoryMessage;
|
||||||
|
|
||||||
|
// We found the quote in memory so update the message in the database
|
||||||
|
// so we don't have to do this check again
|
||||||
|
if (!reallyNotFound) {
|
||||||
|
window.log.info(
|
||||||
|
`getPropsForQuote: Found ${sentAt}, scheduling an update to ${messageId}`
|
||||||
|
);
|
||||||
|
this.set({
|
||||||
|
quote: {
|
||||||
|
...quote,
|
||||||
|
referencedMessageNotFound: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
window.Signal.Util.updateMessageBatcher.add(this.attributes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const authorPhoneNumber = format(author, {
|
const authorPhoneNumber = format(author, {
|
||||||
ourRegionCode: regionCode,
|
ourRegionCode: regionCode,
|
||||||
});
|
});
|
||||||
|
@ -1158,7 +1187,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
authorTitle,
|
authorTitle,
|
||||||
authorName,
|
authorName,
|
||||||
authorColor,
|
authorColor,
|
||||||
referencedMessageNotFound,
|
referencedMessageNotFound: reallyNotFound,
|
||||||
onClick: () => this.trigger('scroll-to-message'),
|
onClick: () => this.trigger('scroll-to-message'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue