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
|
// eslint-disable-next-line no-param-reassign
|
||||||
message.quotedMessageFromDatabase = queryMessage;
|
message.quotedMessageFromDatabase = queryMessage;
|
||||||
|
|
||||||
this.forceRender(message);
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
async loadQuotedMessage(message, quotedMessage) {
|
async loadQuotedMessage(message, quotedMessage) {
|
||||||
|
@ -1174,7 +1173,6 @@
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
message.quoteThumbnail = thumbnailWithData;
|
message.quoteThumbnail = thumbnailWithData;
|
||||||
|
|
||||||
this.forceRender(message);
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
async processQuotes(messages) {
|
async processQuotes(messages) {
|
||||||
|
@ -1201,6 +1199,13 @@
|
||||||
if (quotedMessage) {
|
if (quotedMessage) {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
await this.loadQuotedMessage(message, quotedMessage);
|
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);
|
this.forceRender(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1222,11 +1227,21 @@
|
||||||
// 2. Go to the database for the real referenced attachment
|
// 2. Go to the database for the real referenced attachment
|
||||||
const loaded = await this.loadQuotedMessageFromDatabase(message, id);
|
const loaded = await this.loadQuotedMessageFromDatabase(message, id);
|
||||||
if (loaded) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Finally, use the provided thumbnail
|
// 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);
|
return Promise.all(promises);
|
||||||
|
|
|
@ -366,14 +366,19 @@
|
||||||
this.timerView.update();
|
this.timerView.update();
|
||||||
},
|
},
|
||||||
getQuoteObjectUrl() {
|
getQuoteObjectUrl() {
|
||||||
if (this.model.quotedMessageFromDatabase) {
|
const fromDB = this.model.quotedMessageFromDatabase;
|
||||||
return this.model.quotedMessageFromDatabase.imageUrl;
|
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;
|
return null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue