New MessageController as the single place for in-memory messages

This commit is contained in:
Scott Nonnenberg 2019-03-25 18:10:30 -07:00
parent 274949b247
commit 74cb808763
11 changed files with 169 additions and 105 deletions

View file

@ -729,13 +729,15 @@
const collection = await window.Signal.Data.getMessagesBySentAt(id, {
MessageCollection: Whisper.MessageCollection,
});
const messageFromDatabase = collection.find(item => {
const messageAuthor = item.getContact();
const found = Boolean(
collection.find(item => {
const messageAuthor = item.getContact();
return messageAuthor && author === messageAuthor.id;
});
return messageAuthor && author === messageAuthor.id;
})
);
if (messageFromDatabase) {
if (found) {
const toast = new Whisper.FoundButNotLoadedToast();
toast.$el.appendTo(this.$el);
toast.render();