fix: generate identity verification URL only if ACCOUNT_MICROFRONTEND_URL is available - #36898
Conversation
|
Thanks for the pull request, @arslanashraf7! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
9af3e76 to
3ea742f
Compare
|
Hi @kdmccormick. Sorry to tag you directly, but is it possible for you to review this PR? It fixes an issue with #36870 that you reviewed recently. |
kdmccormick
left a comment
There was a problem hiding this comment.
Thanks for the PR.
Broader question, do these functions even make sense ifaccount_base_url == ""? In those cases, do we really want to send an email with reverify_url == "/id-verification"? Won't that be an invalid link from the perspective of the recipient?
|
|
||
| site = Site.objects.get_current() | ||
| account_base_url = settings.ACCOUNT_MICROFRONTEND_URL.rstrip('/') | ||
| account_base_url = (getattr(settings, "ACCOUNT_MICROFRONTEND_URL", "") or "").rstrip('/') |
There was a problem hiding this comment.
| account_base_url = (getattr(settings, "ACCOUNT_MICROFRONTEND_URL", "") or "").rstrip('/') | |
| account_base_url = (settings.ACCOUNT_MICROFRONTEND_URL or "").rstrip('/') |
getattr is mistake-prone and should only ever be used if absolutely necessary. In all these occurrences, setting.ACCOUNT_MICROFRONTEND_URL is always defined (even if only as None), so you can simply use or in order to fall back to the empty string.
@kdmccormick I agree. I thought about that too, but it felt like a product decision to me, and eventually, this might be something we'll have to think on a larger scale for all the places, and not just email, where we are generating links based on the Account MFE URL. This was a reason I kept that out of the scope of this PR. Let me know if you think otherwise. |
317b7d1 to
8cb6918
Compare
8cb6918 to
f3faec2
Compare
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
|
2U Release Notice: This PR has been deployed to the edX production environment. |
…penedx#36898) The api/courseware/course fails for all the verified enrollments if you are not using Account MFE, which means that you probably won't set ACCOUNT_MICROFRONTEND_URL in your settings/configurations. So this PR adds a check safely try to do rstrip. Fixes a bug in openedx#36870
|
@kdmccormick, I noticed that the #36870 was backported to Teak via #36880. So, I have created #36924 to backport this fix to Teak as well. |
Related Tickets
https://github.com/mitodl/hq/issues/7549
Description
The api/courseware/course fails for all the verified enrollments if you are not using Account MFE, which means that you probably won't set
ACCOUNT_MICROFRONTEND_URLin your settings/configurations. So this PR adds a check safely try to dorstrip.Useful information to include:
The api/courseware/course is currently broken for enrollments in verified mode if you are not using Account MFE. API current edx-platform master
Impacts: All roles
Supporting information
This issue was a side effect of a recent change #36870
Testing instructions
verifiedmode in the course modes and have a verified enrollment)ACCOUNT_MICROFRONTEND_URL = Nonein your settingsDeadline
Probably soon because this breaks verified enrollments for deployments not using accounts MFE.