Quote post performance improvements

This commit is contained in:
Alex Gleason 2022-01-24 13:23:29 -06:00
parent 9f98fcff09
commit 5c755c8f9b
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 8 additions and 1 deletions

View File

@ -37,7 +37,12 @@ export function normalizeAccount(account) {
} }
export function normalizeStatus(status, normalOldStatus, expandSpoilers) { export function normalizeStatus(status, normalOldStatus, expandSpoilers) {
const normalStatus = { ...status }; const normalStatus = { ...status };
// Copy the pleroma object too, so we can modify our copy
if (status.pleroma) {
normalStatus.pleroma = { ...status.pleroma };
}
normalStatus.account = status.account.id; normalStatus.account = status.account.id;
@ -50,7 +55,9 @@ export function normalizeStatus(status, normalOldStatus, expandSpoilers) {
} }
if (status.pleroma && status.pleroma.quote && status.pleroma.quote.id) { if (status.pleroma && status.pleroma.quote && status.pleroma.quote.id) {
// Normalize quote to the top-level, so delete the original for performance
normalStatus.quote = status.pleroma.quote.id; normalStatus.quote = status.pleroma.quote.id;
delete normalStatus.pleroma.quote;
} else if (status.quote && status.quote.id) { } else if (status.quote && status.quote.id) {
// Fedibird compatibility, because why not // Fedibird compatibility, because why not
normalStatus.quote = status.quote.id; normalStatus.quote = status.quote.id;