-
-
Notifications
You must be signed in to change notification settings - Fork 486
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
Attempt to address volunteer#create invalid email error in bot-bugsag #6224
base: main
Are you sure you want to change the base?
Conversation
…_key_value_pairs'
@@ -31,14 +31,17 @@ def create | |||
@volunteer = current_organization.volunteers.new(create_volunteer_params) | |||
authorize @volunteer | |||
|
|||
if @volunteer.save | |||
if @volunteer.save && @volunteer.email.match?(URI::MailTo::EMAIL_REGEXP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs specs but a good start!
The regex addition didn't solve the real life error case of an email address with a close parentheses at the end for if @volunteer.save
@volunteer.invite!(current_user)
# call short io api here
invitation_url = Rails.application.routes.url_helpers.accept_user_invitation_url(invitation_token: @volunteer.raw_invitation_token, host: request.base_url) I suggest wrapping |
What github issue is this PR for, if any?
Resolves #NaN
Noticed an error with
volunteers#create
through the discord.Likely due to an invalid or non standard email.
I refactored it to ensure in the volunteers_controller
create
function....Before an invite can be sent to the user.