Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow wall mods to file hiatuses
  • Loading branch information
regalijan committed Feb 29, 2024
1 parent 0334dc1 commit 15351b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion components/InactivityNoticeCard.tsx
Expand Up @@ -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 ? (
Expand Down
10 changes: 6 additions & 4 deletions components/NewInactivityNotice.tsx
Expand Up @@ -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,
}),
Expand Down Expand Up @@ -147,7 +149,7 @@ export default function (props: {
))}
</VStack>
</CheckboxGroup>
{departments.includes("DM") ? (
{["DM", "WM"].find((d) => departments.includes(d)) ? (
<>
<br />
<br />
Expand All @@ -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>
</>
Expand Down
4 changes: 2 additions & 2 deletions functions/api/inactivity/validate.ts
Expand Up @@ -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()) ||
Expand Down

0 comments on commit 15351b3

Please sign in to comment.