Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: non-hacker confirm button disable conditions #373

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api/src/admin/participant_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def confirm_attendance_non_hacker(uid: str, director: User) -> None:
if not record or record["role"] not in NON_HACKER_ROLES:
raise ValueError

update_status = await mongodb_handler.raw_update_one(
update_status = await mongodb_handler.update_one(
Collection.USERS,
{"_id": uid},
{"status": Status.ATTENDING},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from "@cloudscape-design/components/button";

import UserContext from "@/lib/admin/UserContext";
import { isCheckinLead, isNonHacker } from "@/lib/admin/authorization";
import { Status } from "@/lib/admin/useApplicant";
import { ReviewStatus, Status } from "@/lib/admin/useApplicant";
import { Participant } from "@/lib/admin/useParticipants";
import ParticipantActionPopover from "./ParticipantActionPopover";

Expand Down Expand Up @@ -61,10 +61,13 @@ function ParticipantAction({
</Button>
);

if (nonHacker && isWaiverSigned) {
if (role !== "director") {
if (nonHacker) {
const content = !isCheckinLead
? "Only check-in leads can confirm non-hackers."
: "Must sign waiver first.";
if (!isCheckinLead || participant.status === ReviewStatus.reviewed) {
return (
<ParticipantActionPopover content="Only directors are allowed to confirm non-hackers.">
<ParticipantActionPopover content={content}>
{confirmButton}
</ParticipantActionPopover>
);
Expand Down
Loading