Allow share record creation when disabled at team level for private sharing

This commit is contained in:
Tom Moor
2023-10-25 20:50:09 -04:00
parent 35fd1227e7
commit bf6bd3f8d0

View File

@@ -74,13 +74,13 @@ function SharePopover({
useKeyDown("Escape", onRequestClose); useKeyDown("Escape", onRequestClose);
React.useEffect(() => { React.useEffect(() => {
if (visible && team.sharing) { if (visible) {
void document.share(); void document.share();
buttonRef.current?.focus(); buttonRef.current?.focus();
} }
return () => (timeout.current ? clearTimeout(timeout.current) : undefined); return () => (timeout.current ? clearTimeout(timeout.current) : undefined);
}, [document, visible, team.sharing]); }, [document, visible]);
React.useEffect(() => { React.useEffect(() => {
if (!visible) { if (!visible) {
@@ -201,11 +201,9 @@ function SharePopover({
const userLocale = useUserLocale(); const userLocale = useUserLocale();
const locale = userLocale ? dateLocale(userLocale) : undefined; const locale = userLocale ? dateLocale(userLocale) : undefined;
let shareUrl = team.sharing let shareUrl = sharedParent?.url
? sharedParent?.url ? `${sharedParent.url}${document.url}`
? `${sharedParent.url}${document.url}` : share?.url ?? "";
: share?.url ?? ""
: `${team.url}${document.url}`;
if (isEditMode) { if (isEditMode) {
shareUrl += "?edit=true"; shareUrl += "?edit=true";
} }
@@ -328,7 +326,7 @@ function SharePopover({
<CopyToClipboard text={shareUrl} onCopy={handleCopied}> <CopyToClipboard text={shareUrl} onCopy={handleCopied}>
<Button <Button
type="submit" type="submit"
disabled={(!share && team.sharing) || slugValidationError} disabled={!share || slugValidationError}
ref={buttonRef} ref={buttonRef}
> >
{t("Copy link")} {t("Copy link")}