Allow wall mods to file hiatuses

This commit is contained in:
Regalijan 2024-02-29 02:14:42 -05:00
parent 0334dc1678
commit 15351b3c12
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520
3 changed files with 11 additions and 7 deletions

View File

@ -89,7 +89,9 @@ export default function (
{typeof props.hiatus === "boolean" ? (
<Box>
<Heading size="xs">Notice Type</Heading>
<Text>{props.hiatus ? "Hiatus" : "Inactivity"}</Text>
<Text>
{props.hiatus ? "Hiatus/Inactivity" : "Activity Decrease"}
</Text>
</Box>
) : null}
{props.decisions ? (

View File

@ -69,7 +69,9 @@ export default function (props: {
body: JSON.stringify({
departments,
end,
hiatus: departments.includes("DM") ? isHiatus : undefined,
hiatus: ["DM", "WM"].find((d) => departments.includes(d))
? isHiatus
: undefined,
reason,
start,
}),
@ -147,7 +149,7 @@ export default function (props: {
))}
</VStack>
</CheckboxGroup>
{departments.includes("DM") ? (
{["DM", "WM"].find((d) => departments.includes(d)) ? (
<>
<br />
<br />
@ -156,8 +158,8 @@ export default function (props: {
value={JSON.stringify(isHiatus)}
>
<HStack>
<Radio value="false">Inactivity</Radio>
<Radio value="true">Hiatus</Radio>
<Radio value="false">Activity Decrease</Radio>
<Radio value="true">Inactivity/Hiatus</Radio>
</HStack>
</RadioGroup>
</>

View File

@ -32,8 +32,8 @@ export default function (
if (typeof hiatus !== "undefined" && typeof hiatus !== "boolean")
return jsonError("Invalid notice", 400);
if (!selectedDepartments.includes("DM") && hiatus)
return jsonError("Only discord mods can file hiatuses", 400);
if (!["DM", "WM"].find((d) => selectedDepartments.includes(d)) && hiatus)
return jsonError("Only discord and wall mods can file hiatuses", 400);
if (
isNaN(endDate.getFullYear()) ||