-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Account Activation cleanup #22468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Account Activation cleanup #22468
Conversation
a3590b7 to
63a1a1d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to Reviewers: The tests in this file were simplified to use the users created in ModuleStoreTestCase instead of needing to create and activate new ones. The focus of these tests are not to end-to-end test account creation/activation, but other functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to Reviewers: I updated these tests in order to merge test functionality that was in AccountActivationAndPasswordChangeTest in openedx/core/djangoapps/user_api/accounts/tests/test_api.py.
common/djangoapps/student/urls.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to Reviewers: I double-checked in New Relic that this API has been called 0 times since 6 weeks ago on Stage, Prod, and Edge. I believe it's a much older endpoint since user_api was created.
I'd like to move the remaining (email and activation) account-related views to user_api in a subsequent PR. Then, student will only contain functionality for the student dashboard and roles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still seeing some /activate/ calls from cms (mostly Edge, but some Prod) which invokes this code.
See
SELECT request.uri, appName from Transaction where request.uri like '/activate/%' and appName like '%-cms'
And
SELECT * from Transaction where student_activate_account = 'cms'
I do not know why these are happening. Older activation emails? I do know the redirect to 'dashboard` definitely blows up when called from Studio.
Could we redirect /activate calls from cms to lms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the decoupled commit related to the removal of student_activate_account. That should unblock this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to Reviewers: Thanks to @robrap's metric here, we've verified that activate_account is used only in tests and not in production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to Reviewers: These tests are actually for testing Password Change functionality. I have moved them to test_password.py. Also, they do not need account-activation functionality for tests to pass.
dianakhuang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Hooray for cleanup!
robrap
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great clean-up. I just have questions about activate_account_studio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still seeing some /activate/ calls from cms (mostly Edge, but some Prod) which invokes this code.
See
SELECT request.uri, appName from Transaction where request.uri like '/activate/%' and appName like '%-cms'
And
SELECT * from Transaction where student_activate_account = 'cms'
I do not know why these are happening. Older activation emails? I do know the redirect to 'dashboard` definitely blows up when called from Studio.
Could we redirect /activate calls from cms to lms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible clean-up for a follow-up PR:
When looking at the file, I noticed the following assertNotContains: https://github.com/edx/edx-platform/blob/63a1a1db97e857d28f708117239440eb388c8758/openedx/core/djangoapps/user_authn/views/tests/test_logistration.py#L602
We had some tests that I fixed that used assertNotContains, but no parallel test with assertContains, and the thing that wasn't being found was because it was bogus code, not because some flag was working appropriately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm marking as "Request Changes" to ensure my earlier comment about activate_account_studio is handled before merging. Thanks.
I also updated the subject. Unfortunately, once you have an Approval from someone, it looks pretty merge-able.
63a1a1d to
f539a51
Compare
|
Your PR has finished running tests. There were no failures. |
robrap
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production on Monday, December 16, 2019. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
This PR removes unused and unneeded endpoints and functionality related to account activation, specifically user_api's duplicative
activate_accountfunction, which was only used by tests. As part of this effort, a few surrounding tests and functionality were refactored and removed:change_settingendpoint: Removed since it's not used anywhere in the codebase and not called in production.user_authn.test_views.py: Refactored, moving password-related tests totest_password.py.References: