Skip to content

Commit 4ef7ebb

Browse files
committed
fix: improve share completed dialog redirection for reverse shares
1 parent d870b57 commit 4ef7ebb

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

frontend/src/components/upload/modals/showCompletedUploadModal.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const Body = ({ share, appUrl }: { share: CompletedShare; appUrl: string }) => {
3030
const router = useRouter();
3131
const t = useTranslate();
3232

33+
const isReverseShare = !!router.query["reverseShareToken"];
34+
3335
const link = `${appUrl}/s/${share.id}`;
3436

3537
return (
@@ -65,7 +67,11 @@ const Body = ({ share, appUrl }: { share: CompletedShare; appUrl: string }) => {
6567
<Button
6668
onClick={() => {
6769
modals.closeAll();
68-
router.push("/upload");
70+
if (isReverseShare) {
71+
router.reload();
72+
} else {
73+
router.push("/upload");
74+
}
6975
}}
7076
>
7177
<FormattedMessage id="common.button.done" />

frontend/src/i18n/translations/en-US.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ export default {
291291
"upload.notify.generic-error":
292292
"An error occurred while finishing your share.",
293293
"upload.notify.count-failed": "{count} files failed to upload. Trying again.",
294+
"upload.reverse-share.error.invalid.title": "Invalid reverse share link",
295+
"upload.reverse-share.error.invalid.description":
296+
"This reverse share has expired or is invalid.",
294297

295298
// Dropzone.tsx
296299
"upload.dropzone.title": "Upload files",

frontend/src/pages/upload/[reverseShareToken].tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useEffect, useState } from "react";
55
import Upload from ".";
66
import showErrorModal from "../../components/share/showErrorModal";
77
import shareService from "../../services/share.service";
8+
import useTranslate from "../../hooks/useTranslate.hook";
89

910
export function getServerSideProps(context: GetServerSidePropsContext) {
1011
return {
@@ -14,6 +15,7 @@ export function getServerSideProps(context: GetServerSidePropsContext) {
1415

1516
const Share = ({ reverseShareToken }: { reverseShareToken: string }) => {
1617
const modals = useModals();
18+
const t = useTranslate();
1719
const [isLoading, setIsLoading] = useState(true);
1820

1921
const [maxShareSize, setMaxShareSize] = useState(0);
@@ -30,8 +32,8 @@ const Share = ({ reverseShareToken }: { reverseShareToken: string }) => {
3032
.catch(() => {
3133
showErrorModal(
3234
modals,
33-
"Invalid Link",
34-
"This link is invalid. Please check your link.",
35+
t("upload.reverse-share.error.invalid.title"),
36+
t("upload.reverse-share.error.invalid.description"),
3537
"go-home",
3638
);
3739
setIsLoading(false);

0 commit comments

Comments
 (0)