-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Add openedx-filters hook to account settings before rendering it context #31295
Add openedx-filters hook to account settings before rendering it context #31295
Conversation
Thanks for the pull request, @Henrrypg! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
1c2110d
to
0501284
Compare
Hello! Thanks for your contribution. Please, add a testing example that works for this PR (not for edunext-platform), so it's easier for reviewers. You could use https://github.com/eduNEXT/openedx-filters-samples |
@mariajgrimaldi As you suggested, i opened a PR in openedx-filters-samples with a testing example. What do you think? |
Hi @Henrrypg! Just seeing if you are planning to re-run the failing checks on this? CC: @mariajgrimaldi for review. |
Hello @mphilbrick211, i was working first with openedx/openedx-filters#46, thats why the checks are failling. |
|
||
try: | ||
context = AccountSettingsRenderStarted().run_filter(context=context) | ||
except AccountSettingsRenderStarted.ErrorFilteringContext as exc: |
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 was about to test this in conjunction the other PR (openedx-filters PR 46) but then realized this is not going to work. ErrorFilteringContext is not defined as one of the filter exceptions. Also, try to follow this implementation and adding unittests for this :)
Hi @Henrrypg! Just checking in to see if you are planning to pursue this pull request? |
5760e2c
to
8b1c90a
Compare
Hello @mphilbrick211 @mariajgrimaldi i just pushed a commit with the changes requested by @mariajgrimaldi, unitests and fix the implementation. |
except AccountSettingsRenderStarted.RedirectToPage as exc: | ||
return HttpResponseRedirect(exc.redirect_to) | ||
except AccountSettingsRenderStarted.RenderCustomResponse as exc: | ||
return exc.response |
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.
You're missing one exception. Please, use the other implementations as a guide.
} | ||
return context | ||
|
||
class TestAccountSettingsFilters(SharedModuleStoreTestCase): |
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'd use these tests as a template for testing this kind of filters:
test_account_render_filter_executed
test_account_render_alternative
test_account_redirect
test_account_redirect_default
test_account_custom_response
test_account_render_without_filter_config
Those are precisely the same as here. I know this needs to be documented somewhere -we're working on it- but again, you could use them as a guide.
How you suggested @mariajgrimaldi, i took your example filter and made some changes in favor of that. one exception was missing in filters pr but i already added it. |
I'll check on this again tomorrow! After reviewing openedx/openedx-filters#46 |
@Henrrypg: can you rebase with the base branch? Also, I left a comment here: eduNEXT/openedx-filters-samples#1. It'd be convenient if you fixed it so we can test it easily :) |
openedx-filters v1.2.0 was released already! |
@mariajgrimaldi Sure! I'll work on this |
53f81b8
to
87b9b4b
Compare
@mariajgrimaldi I rebased with master and eduNEXT/openedx-filters-samples#1 is already merged :) |
These are the instructions I followed:
This looks good. The only thing that worries me is our maintenance plan for filters used in legacy pages. cc @felipemontoya |
@Henrrypg: can you please rebase with master and fix conflicts? |
87b9b4b
to
5cbceee
Compare
Is done @mariajgrimaldi, checks are failing because openedx-filters version in master |
@Henrrypg: can you bump openedx-filters to 1.2.0? that's the latest release which has the filter you're including |
As a user of a filter what I would expect:
Do you think one or both of those are applicable here? |
That sounds good! I will take those ideas into our documentation so it's clear for future implementations. I'm attaching the DEPR ticket for account pages here for better tracking. I also created an issue in openedx-filters: openedx/openedx-filters#73 |
4107b3f
to
bec74b2
Compare
@Henrrypg: I'll approve once tests pass :). Let me know! |
@mariajgrimaldi Is ready to test now :) |
e8ea4d3
to
776e65b
Compare
@mariajgrimaldi i just rebased and checks are passing :) |
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.
LGTM
@Henrrypg 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
EdX Release Notice: This PR has been deployed to the production environment. |
Description
This PR introduces a new openedx-filters hook:
org.openedx.learning.student.settings.render.started.v1
hook in the platform at openedx/core/djangoapps/user_api/accounts/settings_views.py. This is implemented to hook the account settings context.Users impacted by the change:
Supporting information
openedx-filter: In this PR #46 is implemented this filter.
Testing instructions
You can have an example of this filter with its hook working in edunext-platform
You also have an example in openedx-filters-samples in this PR: eduNEXT/openedx-filters-samples#1
Deadline
None
Other information
Once accepted, this should be merged only after openedx/openedx-filters#46 is merged and the requirements are updated.