fix: Share popover incorrectly displays draft as publicly shared when parent document is (#2982)

closes #2978
This commit is contained in:
Tom Moor
2022-01-22 18:04:05 -08:00
committed by GitHub
parent e4dbd67ae1
commit 80c6e57aa3
2 changed files with 6 additions and 3 deletions

View File

@@ -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,

View File

@@ -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")}
</Heading>
{sharedParent && (
{sharedParent && !document.isDraft && (
<Notice>
<Trans
defaults="This document is shared because the parent <em>{{ documentTitle }}</em> is publicly shared"