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] Show hidden custom inputs only to authenticated sessions #90

Merged
merged 4 commits into from
Jul 1, 2024
Merged
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
5 changes: 4 additions & 1 deletion apps/web/pages/booking/[uid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
: "Nameless";

const [is24h, setIs24h] = useState(isBrowserLocale24h());
const { data: session } = useSession();
const { data: session, status: sessionStatus } = useSession();

const [date, setDate] = useState(dayjs.utc(props.bookingInfo.startTime));
const { eventType, bookingInfo } = props;
Expand Down Expand Up @@ -262,7 +262,7 @@
setCalculatedDuration(
dayjs(props.bookingInfo.endTime).diff(dayjs(props.bookingInfo.startTime), "minutes")
);
}, []);

Check warning on line 265 in apps/web/pages/booking/[uid].tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

apps/web/pages/booking/[uid].tsx#L265

[react-hooks/exhaustive-deps] React Hook useEffect has missing dependencies: 'props.bookingInfo.endTime' and 'props.bookingInfo.startTime'. Either include them or remove the dependency array. If 'setCalculatedDuration' needs the current value of 'props.bookingInfo.endTime', you can also switch to useReducer instead of useState and read 'props.bookingInfo.endTime' in the reducer.

function eventLink(): string {
const optional: { location?: string } = {};
Expand Down Expand Up @@ -501,6 +501,9 @@
// TODO: Fix this in another PR
const customInput = customInputs[key as keyof typeof customInputs];
const eventTypeCustomFound = eventType.customInputs?.find((ci) => ci.label === key);
if (eventTypeCustomFound?.type === "HIDDEN" && sessionStatus !== "authenticated") {
return null;
}
return (
<>
{eventTypeCustomFound?.type === "RADIO" && (
Expand Down
Loading