Release 1.149.5 - #3549
Release 1.149.5#3549
Conversation
OpenAPI ChangesShow/hide ## Changes for v0.yaml:Unexpected changes? Ensure your branch is up-to-date with |
| EdxApiChangeEmailSettingsException: Raised if an unknown error was encountered during the edX API request | ||
| """ | ||
| edx_client = get_edx_api_client(user) | ||
| if edx_client is None: | ||
| return None |
There was a problem hiding this comment.
Bug: When edX API calls fail and return None, the caller inverts the user's email subscription status in the database instead of propagating the error.
Severity: HIGH
Suggested Fix
The calling view should explicitly check if the response from the subscription/unsubscription functions is None. If it is, the view should not update the database and should return an appropriate error response to indicate that the operation failed, rather than silently saving an incorrect state.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: openedx/api.py#L1391-L1395
Potential issue: When the `IGNORE_EDX_FAILURES` flag is true and an edX API client
cannot be obtained for a user, the functions `subscribe_to_edx_course_emails` and
`unsubscribe_from_edx_course_emails` return `None`. The caller in
`courses/views/v1/__init__.py` misinterprets this `None` value. For a subscription
request, it incorrectly sets `edx_emails_subscription` to `False`, and for an
unsubscription request, it sets it to `True`. This inverted state is saved to the
database, and the API returns a `200 OK` success response, masking the underlying
failure from the user.
Did we get this right? 👍 / 👎 to inform future reviews.
|
There are no logs for "[email] does not have an associated OpenEdxApiAuth" on RC Sentry Created a new user to check it as well. |
Muhammad Anas
Muhammad Arslan
renovate[bot]
Rachel Lougee