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 2 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 @@ -55,16 +55,20 @@ function ParticipantAction({
variant="inline-link"
ariaLabel={`Confirm attendance for ${participant._id}`}
onClick={() => initiateConfirm(participant)}
disabled={!isCheckin}
disabled={nonHacker && isWaiverSigned && role !== "director"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, can you also allow check-in leads to confirm following from #372.

>
Confirm
</Button>
);

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