Load thumbnail even if we have the full message in hand
This is important for now, when we aren't generating our own thumbnails
This commit is contained in:
parent
c283ba1a12
commit
3bbb9f535a
2 changed files with 29 additions and 9 deletions
|
@ -1124,7 +1124,6 @@
|
|||
// eslint-disable-next-line no-param-reassign
|
||||
message.quotedMessageFromDatabase = queryMessage;
|
||||
|
||||
this.forceRender(message);
|
||||
return true;
|
||||
},
|
||||
async loadQuotedMessage(message, quotedMessage) {
|
||||
|
@ -1174,7 +1173,6 @@
|
|||
// eslint-disable-next-line no-param-reassign
|
||||
message.quoteThumbnail = thumbnailWithData;
|
||||
|
||||
this.forceRender(message);
|
||||
return true;
|
||||
},
|
||||
async processQuotes(messages) {
|
||||
|
@ -1201,6 +1199,13 @@
|
|||
if (quotedMessage) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
await this.loadQuotedMessage(message, quotedMessage);
|
||||
|
||||
// Note: in the future when we generate our own thumbnail we won't need to rely
|
||||
// on incoming thumbnail if we have our local message in hand.
|
||||
if (!message.quotedMessage.imageUrl) {
|
||||
await this.loadQuoteThumbnail(message, quote);
|
||||
}
|
||||
|
||||
this.forceRender(message);
|
||||
return;
|
||||
}
|
||||
|
@ -1222,11 +1227,21 @@
|
|||
// 2. Go to the database for the real referenced attachment
|
||||
const loaded = await this.loadQuotedMessageFromDatabase(message, id);
|
||||
if (loaded) {
|
||||
// Note: in the future when we generate our own thumbnail we won't need to rely
|
||||
// on incoming thumbnail if we have our local message in hand.
|
||||
if (!message.quotedMessageFromDatabase.imageUrl) {
|
||||
await this.loadQuoteThumbnail(message, quote);
|
||||
}
|
||||
|
||||
this.forceRender(message);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Finally, use the provided thumbnail
|
||||
await this.loadQuoteThumbnail(message, quote);
|
||||
const gotThumbnail = await this.loadQuoteThumbnail(message, quote);
|
||||
if (gotThumbnail) {
|
||||
this.forceRender(message);
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.all(promises);
|
||||
|
|
|
@ -366,14 +366,19 @@
|
|||
this.timerView.update();
|
||||
},
|
||||
getQuoteObjectUrl() {
|
||||
if (this.model.quotedMessageFromDatabase) {
|
||||
return this.model.quotedMessageFromDatabase.imageUrl;
|
||||
const fromDB = this.model.quotedMessageFromDatabase;
|
||||
if (fromDB && fromDB.imageUrl) {
|
||||
return fromDB.imageUrl;
|
||||
}
|
||||
if (this.model.quotedMessage) {
|
||||
return this.model.quotedMessage.imageUrl;
|
||||
|
||||
const inMemory = this.model.quotedMessage;
|
||||
if (inMemory && inMemory.imageUrl) {
|
||||
return inMemory.imageUrl;
|
||||
}
|
||||
if (this.model.quoteThumbnail) {
|
||||
return this.model.quoteThumbnail.objectUrl;
|
||||
|
||||
const thumbnail = this.model.quoteThumbnail;
|
||||
if (thumbnail && thumbnail.objectUrl) {
|
||||
return thumbnail.objectUrl;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue