From 5c755c8f9b46f7d396c95dc628fa97caa8a857ac Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 24 Jan 2022 13:23:29 -0600 Subject: [PATCH] Quote post performance improvements --- app/soapbox/actions/importer/normalizer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/soapbox/actions/importer/normalizer.js b/app/soapbox/actions/importer/normalizer.js index b9ea87ee9..fae8b2787 100644 --- a/app/soapbox/actions/importer/normalizer.js +++ b/app/soapbox/actions/importer/normalizer.js @@ -37,7 +37,12 @@ export function normalizeAccount(account) { } 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; @@ -50,7 +55,9 @@ export function normalizeStatus(status, normalOldStatus, expandSpoilers) { } 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; + delete normalStatus.pleroma.quote; } else if (status.quote && status.quote.id) { // Fedibird compatibility, because why not normalStatus.quote = status.quote.id;