feat: add more options to reverse shares (#495)
* feat(reverse-share): optional simplified interface for reverse sharing. issue #155. * chore: Remove useless form validation. * feat: Share Ready modal adds a prompt that an email has been sent to the reverse share creator. * fix: Simplified reverse shared interface elements lack spacing when not logged in. * fix: Share Ready modal prompt contrast is too low in dark mode. * feat: add public access options to reverse share. * feat: remember reverse share simplified and publicAccess options in cookies. * style: npm run format. * chore(i18n): Improve translation. Co-authored-by: Elias Schneider <login@eliasschneider.com> Update frontend/src/i18n/translations/en-US.ts Co-authored-by: Elias Schneider <login@eliasschneider.com> Update frontend/src/i18n/translations/en-US.ts Co-authored-by: Elias Schneider <login@eliasschneider.com> chore(i18n): Improve translation. * chore: Improved variable naming. * chore(i18n): Improve translation. x2. * fix(backend/shares): Misjudged the permission of the share of the reverse share.
This commit is contained in:
@@ -43,6 +43,12 @@ const Share = ({ shareId }: { shareId: string }) => {
|
||||
t("share.error.not-found.description"),
|
||||
);
|
||||
}
|
||||
} else if (e.response.status == 403 && error == "share_removed") {
|
||||
showErrorModal(
|
||||
modals,
|
||||
t("share.error.access-denied.title"),
|
||||
t("share.error.access-denied.description"),
|
||||
);
|
||||
} else {
|
||||
showErrorModal(modals, t("common.error"), t("common.error.unknown"));
|
||||
}
|
||||
|
||||
@@ -69,6 +69,12 @@ const Share = ({ shareId }: { shareId: string }) => {
|
||||
"go-home",
|
||||
);
|
||||
}
|
||||
} else if (e.response.status == 403 && error == "private_share") {
|
||||
showErrorModal(
|
||||
modals,
|
||||
t("share.error.access-denied.title"),
|
||||
t("share.error.access-denied.description"),
|
||||
);
|
||||
} else if (error == "share_password_required") {
|
||||
showEnterPasswordModal(modals, getShareToken);
|
||||
} else if (error == "share_token_required") {
|
||||
|
||||
@@ -17,12 +17,14 @@ const Share = ({ reverseShareToken }: { reverseShareToken: string }) => {
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
const [maxShareSize, setMaxShareSize] = useState(0);
|
||||
const [simplified, setSimplified] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
shareService
|
||||
.setReverseShare(reverseShareToken)
|
||||
.then((reverseShareTokenData) => {
|
||||
setMaxShareSize(parseInt(reverseShareTokenData.maxShareSize));
|
||||
setSimplified(reverseShareTokenData.simplified);
|
||||
setIsLoading(false);
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -38,7 +40,13 @@ const Share = ({ reverseShareToken }: { reverseShareToken: string }) => {
|
||||
|
||||
if (isLoading) return <LoadingOverlay visible />;
|
||||
|
||||
return <Upload isReverseShare maxShareSize={maxShareSize} />;
|
||||
return (
|
||||
<Upload
|
||||
isReverseShare
|
||||
maxShareSize={maxShareSize}
|
||||
simplified={simplified}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default Share;
|
||||
|
||||
@@ -25,9 +25,11 @@ let createdShare: Share;
|
||||
const Upload = ({
|
||||
maxShareSize,
|
||||
isReverseShare = false,
|
||||
simplified,
|
||||
}: {
|
||||
maxShareSize?: number;
|
||||
isReverseShare: boolean;
|
||||
simplified: boolean;
|
||||
}) => {
|
||||
const modals = useModals();
|
||||
const t = useTranslate();
|
||||
@@ -133,6 +135,7 @@ const Upload = ({
|
||||
),
|
||||
enableEmailRecepients: config.get("email.enableShareEmailRecipients"),
|
||||
maxExpirationInHours: config.get("share.maxExpiration"),
|
||||
simplified,
|
||||
},
|
||||
files,
|
||||
uploadFiles,
|
||||
|
||||
Reference in New Issue
Block a user