Skip to content

fix(enrol_requests): fix recaptcha sign up behavior#8310

Merged
adi-herwana-nus merged 1 commit intomasterfrom
adi/user-signup-recaptcha-fix
Apr 19, 2026
Merged

fix(enrol_requests): fix recaptcha sign up behavior#8310
adi-herwana-nus merged 1 commit intomasterfrom
adi/user-signup-recaptcha-fix

Conversation

@adi-herwana-nus
Copy link
Copy Markdown
Contributor

  • refactored enrol request auto-approve behavior into model hooks
  • removed /create_unauthenticated endpoint, merged its functionality into sign_up endpoint

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors course enrolment request handling to support reCAPTCHA-backed sign-up enrolment flows by moving auto-approve + notifications into model hooks and removing the unauthenticated enrol-request endpoint.

Changes:

  • Move enrol request auto-approval and notification dispatch into Course::EnrolRequest callbacks.
  • Remove /enrol_requests/create_unauthenticated and pass enrol_course_id through /users sign-up to create an enrol request during registration.
  • Update frontend API/types and extend controller/model specs for the new sign-up + enrol-request behavior.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
spec/models/course/enrol_request_spec.rb Adjusts approval setup to match new model behavior.
spec/controllers/user/registration_controller_spec.rb Adds coverage for sign-up with enrol_course_id (404/403/created/auto-approve).
spec/controllers/course/enrol_requests_controller_spec.rb Adds coverage for non-enrollable courses + auto-approve; updates mail expectations.
config/routes.rb Removes create_unauthenticated enrol request route.
client/app/types/users.ts Adds SignUpResponseData including optional enrolRequest.
client/app/types/course/enrolRequests.ts Narrows enrol request status type to known workflow states.
client/app/bundles/users/pages/SignUpPage.tsx Passes enrolCourseId to sign-up and removes extra unauth enrol-request call.
client/app/api/course/Courses.ts Removes unauth enrol-request submission helper.
client/app/api/Users.ts Extends signUp to submit enrol_course_id and use SignUpResponseData.
app/views/user/registrations/create.json.jbuilder Adds optional enrolRequest to sign-up response.
app/models/course/enrol_request.rb Introduces auto-approve + after-commit notification hooks; adds create_course_user.
app/controllers/user/registrations_controller.rb Creates enrol request during sign-up when enrol_course_id is provided.
app/controllers/course/enrol_requests_controller.rb Removes unauth create action; simplifies create; refactors approve/reject mail dispatch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/models/course/enrol_request.rb Outdated
Comment thread app/controllers/course/enrol_requests_controller.rb
Comment thread app/controllers/user/registrations_controller.rb
Comment thread app/controllers/user/registrations_controller.rb Outdated
Comment thread app/models/course/enrol_request.rb
- refactored enrol request auto-approve behavior into model hooks
- removed /create_unauthenticated endpoint, merged its functionality into sign_up endpoint
@adi-herwana-nus adi-herwana-nus force-pushed the adi/user-signup-recaptcha-fix branch from 21982b8 to 7d5cfd0 Compare April 19, 2026 21:03
@adi-herwana-nus adi-herwana-nus merged commit cbcf74c into master Apr 19, 2026
14 checks passed
@adi-herwana-nus adi-herwana-nus deleted the adi/user-signup-recaptcha-fix branch April 19, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants