From faa67a7403ddad196dd7a4c052ecdd0985d4135f Mon Sep 17 00:00:00 2001 From: Saumya Pandey Date: Fri, 27 Aug 2021 00:01:41 +0530 Subject: [PATCH] Remove computedCollectionId --- app/components/DocumentBreadcrumb.js | 12 +++++++++++- app/components/DocumentListItem.js | 6 ++++-- app/components/DocumentMeta.js | 4 +++- app/menus/DocumentMenu.js | 6 ++++-- app/menus/NewChildDocumentMenu.js | 2 +- app/models/Document.js | 5 ----- app/scenes/Document/components/Header.js | 4 ++-- app/scenes/Document/components/References.js | 2 +- app/scenes/DocumentDelete.js | 2 +- app/stores/DocumentsStore.js | 2 +- app/stores/SharesStore.js | 2 +- app/utils/routeHelpers.js | 3 ++- shared/i18n/locales/en_US/translation.json | 4 ++-- 13 files changed, 33 insertions(+), 21 deletions(-) diff --git a/app/components/DocumentBreadcrumb.js b/app/components/DocumentBreadcrumb.js index d5d4636236..eaf7a70d74 100644 --- a/app/components/DocumentBreadcrumb.js +++ b/app/components/DocumentBreadcrumb.js @@ -58,9 +58,19 @@ function useCategory(document) { const DocumentBreadcrumb = ({ document, children, onlyText }: Props) => { const { collections } = useStores(); + const { t } = useTranslation(); const category = useCategory(document); - let collection = collections.get(document.computedCollectionId); + let collection = collections.get(document.collectionId || ""); + + if (!collection && document.collectionId) { + collection = { + id: document.collectionId, + name: t("Deleted Collection"), + color: "currentColor", + url: "deleted-collection", + }; + } const path = React.useMemo( () => diff --git a/app/components/DocumentListItem.js b/app/components/DocumentListItem.js index 4fff906daa..a0de28b825 100644 --- a/app/components/DocumentListItem.js +++ b/app/components/DocumentListItem.js @@ -65,7 +65,9 @@ function DocumentListItem(props: Props, ref) { !!document.title.toLowerCase().includes(highlight.toLowerCase()); const canStar = policies.abilities(document.id).star; const can = policies.abilities(currentTeam.id); - const canCollection = document.collectionId ? policies.abilities(document.collectionId) : {}; + const collectionPolicy = document.collectionId + ? policies.abilities(document.collectionId) + : {}; return (