fix(enrol_requests): fix recaptcha sign up behavior#8310
Merged
adi-herwana-nus merged 1 commit intomasterfrom Apr 19, 2026
Merged
fix(enrol_requests): fix recaptcha sign up behavior#8310adi-herwana-nus merged 1 commit intomasterfrom
adi-herwana-nus merged 1 commit intomasterfrom
Conversation
Contributor
adi-herwana-nus
commented
Apr 19, 2026
- refactored enrol request auto-approve behavior into model hooks
- removed /create_unauthenticated endpoint, merged its functionality into sign_up endpoint
There was a problem hiding this comment.
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::EnrolRequestcallbacks. - Remove
/enrol_requests/create_unauthenticatedand passenrol_course_idthrough/userssign-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.
- refactored enrol request auto-approve behavior into model hooks - removed /create_unauthenticated endpoint, merged its functionality into sign_up endpoint
21982b8 to
7d5cfd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.