Quote loading: Check for in-memory message until we get one
This commit is contained in:
parent
92a89a8e41
commit
fc330ef854
1 changed files with 14 additions and 7 deletions
|
@ -1148,14 +1148,14 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We've already gone through this method once for this message
|
// If we already have a quoted message, then we exit early. If we don't have it,
|
||||||
if (message.quoteIsProcessed) {
|
// then we'll continue to look again for an in-memory message to use. Why? This
|
||||||
|
// will enable us to scroll to it when the user clicks.
|
||||||
|
if (messages.quotedMessage) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-param-reassign
|
|
||||||
message.quoteIsProcessed = true;
|
|
||||||
|
|
||||||
// First, check to see if we've already loaded the target message into memory
|
// 1. Check to see if we've already loaded the target message into memory
|
||||||
const { author, id } = quote;
|
const { author, id } = quote;
|
||||||
const key = this.makeKey(author, id);
|
const key = this.makeKey(author, id);
|
||||||
const quotedMessage = lookup[key];
|
const quotedMessage = lookup[key];
|
||||||
|
@ -1167,13 +1167,20 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then go to the database for the real referenced attachment
|
// We've don't want to go to the database or load thumbnails a second time.
|
||||||
|
if (message.quoteIsProcessed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
message.quoteIsProcessed = true;
|
||||||
|
|
||||||
|
// 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) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, use the provided thumbnail
|
// 3. Finally, use the provided thumbnail
|
||||||
await this.loadQuoteThumbnail(message, quote);
|
await this.loadQuoteThumbnail(message, quote);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue