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

Feat/Fix: Add Prospects to Subcourse & Prevent Invalid Email Changes #560

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

realmayus
Copy link
Contributor

…pects,

prevent user from changing email to itself (violates uniqueness constraint in DB)
@Jonasdoubleyou Jonasdoubleyou temporarily deployed to user-app-feat-add-prosp-zfashv June 6, 2024 13:03 Inactive
@Jonasdoubleyou Jonasdoubleyou temporarily deployed to user-app-feat-add-prosp-nfznjf June 6, 2024 13:21 Inactive
const handleAddPupil = useCallback(
async (pupilId: number) => {
try {
await addProspect({ variables: { subcourseId: subcourseId, pupilId: pupilId } });
Copy link
Member

Choose a reason for hiding this comment

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

while this is loading I could click the button again

data?.me?.email.toLowerCase().trim() === newEmail?.toLowerCase().trim()
? t('reasonsDisabled.didNotChangeEmail')
: t('reasonsDisabled.invalidEMail')
}
width={buttonWidth}
Copy link
Member

Choose a reason for hiding this comment

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

How does this "Prevent invalid email changes" - It just swaps the disabled message in that case?

Copy link
Member

Choose a reason for hiding this comment

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

And if it hits the uniqueness constraint we probably also miss validation on backend side.

@Jonasdoubleyou
Copy link
Member

(would prefer one change per PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants