Fix "get perms" alert not shown if no video adder perms

This commit is contained in:
Kalle
2025-03-04 22:04:17 +02:00
parent c31ee4244b
commit 02d92b07ae
2 changed files with 12 additions and 1 deletions

View File

@@ -35,10 +35,12 @@ import {
} from "~/utils/remix.server";
import { vodVideoPage } from "~/utils/urls";
import { actualNumber, id } from "~/utils/zod";
import { Alert } from "../../../components/Alert";
import { DateFormField } from "../../../components/form/DateFormField";
import { MyForm } from "../../../components/form/MyForm";
import { SelectFormField } from "../../../components/form/SelectFormField";
import { TextFormField } from "../../../components/form/TextFormField";
import { useUser } from "../../auth/core/user";
import { createVod, updateVodByReplacing } from "../queries/createVod.server";
import { findVodById } from "../queries/findVodById.server";
import { videoMatchTypes } from "../vods-constants";
@@ -127,9 +129,18 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
export type VodFormFields = z.infer<typeof videoInputSchema>;
export default function NewVodPage() {
const user = useUser();
const data = useLoaderData<typeof loader>();
const { t } = useTranslation(["vods"]);
if (!user || !user.isVideoAdder) {
return (
<Main className="stack items-center">
<Alert variation="WARNING">{t("vods:gainPerms")}</Alert>
</Main>
);
}
return (
<Main halfWidth>
<MyForm

View File

@@ -23,6 +23,6 @@
"forms.action.addMatch": "Add match",
"forms.action.deleteMatch": "Delete match",
"noVods": "No videos found matching this filter. Are we missing something? See the FAQ page on information about how to gain VoD uploading permissions.",
"gainPerms": "Please post on the helpdesk of our Discord to gain permissions to upload videos.",
"gainPerms": "Please post on the helpdesk of our Discord to gain permissions to upload videos",
"deleteConfirm": "Delete video with the title '{{title}}'?"
}