From 80c6e57aa308d875221140692a3520c113ac2f9e Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 22 Jan 2022 18:04:05 -0800 Subject: [PATCH] fix: Share popover incorrectly displays draft as publicly shared when parent document is (#2982) closes #2978 --- app/scenes/Document/components/ShareButton.tsx | 3 ++- app/scenes/Document/components/SharePopover.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/scenes/Document/components/ShareButton.tsx b/app/scenes/Document/components/ShareButton.tsx index 9488f9a90..333d7fc08 100644 --- a/app/scenes/Document/components/ShareButton.tsx +++ b/app/scenes/Document/components/ShareButton.tsx @@ -20,7 +20,8 @@ function ShareButton({ document }: Props) { const share = shares.getByDocumentId(document.id); const sharedParent = shares.getByDocumentParents(document.id); const isPubliclyShared = - (share && share.published) || (sharedParent && sharedParent.published); + (share && share.published) || + (sharedParent && sharedParent.published && !document.isDraft); const popover = usePopoverState({ gutter: 0, diff --git a/app/scenes/Document/components/SharePopover.tsx b/app/scenes/Document/components/SharePopover.tsx index db634bbad..b25acb98e 100644 --- a/app/scenes/Document/components/SharePopover.tsx +++ b/app/scenes/Document/components/SharePopover.tsx @@ -46,7 +46,9 @@ function SharePopover({ !document.isTemplate && auth.team?.sharing && documentAbilities.share; - const isPubliclyShared = (share && share.published) || sharedParent; + const isPubliclyShared = + (share && share.published) || + (sharedParent && sharedParent.published && !document.isDraft); useKeyDown("Escape", onRequestClose); @@ -117,7 +119,7 @@ function SharePopover({ {t("Share this document")} - {sharedParent && ( + {sharedParent && !document.isDraft && (