Skip to content

Honor the enrollment mode in the Open edX enrollment webhook - #3840

Open
Anas12091101 wants to merge 1 commit into
mainfrom
anas/enrollment-webhook-honor-mode
Open

Honor the enrollment mode in the Open edX enrollment webhook#3840
Anas12091101 wants to merge 1 commit into
mainfrom
anas/enrollment-webhook-honor-mode

Conversation

@Anas12091101

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

mitodl/hq#12748

Description (What does it do?)

edx_enrollment_webhook now forwards the payload's optional mode to create_local_enrollment instead of always enrolling at the default audit mode. Absent or empty values fall back to the default, so the existing course access role callers are unaffected.

Pairs with the ol_openedx_events_handler change in mitodl/open-edx-plugins, which starts sending mode.

How can this be tested?

pytest openedx/views_test.py — 33 pass.

Or POST to /api/openedx_webhook/enrollment/ with {"email": ..., "course_id": ..., "mode": "verified"} and confirm the resulting CourseRunEnrollment.enrollment_mode is verified. Existing enrollments keep their mode, since create_local_enrollment uses get_or_create.

@Anas12091101
Anas12091101 requested a balanced review from Copilot August 11, 2026 11:18
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
No changes detected

## Changes for v1.yaml:
No changes detected

## Changes for v2.yaml:
No changes detected

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the Open edX enrollment webhook to preserve enrollment modes locally.

Changes:

  • Forwards the payload’s optional mode with an audit fallback.
  • Adds coverage for mode handling and existing enrollments.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
openedx/views.py Processes and logs webhook enrollment modes.
openedx/views_test.py Tests mode forwarding, defaults, and idempotency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

edx_enrollment_webhook now forwards the payload's optional "mode" to
create_local_enrollment instead of always enrolling at the default audit
mode. Absent or empty values fall back to the default, so the existing
course access role callers are unaffected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Anas12091101
Anas12091101 force-pushed the anas/enrollment-webhook-honor-mode branch from 998aa8d to b21dd01 Compare August 11, 2026 11:54
@asadali145 asadali145 self-assigned this Aug 12, 2026

@asadali145 asadali145 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants