Skip to content

Add openedx-filters hook to account settings before rendering it context - #31295

Merged
mariajgrimaldi merged 6 commits into
openedx:masterfrom
eduNEXT:hpg/add-filters-hook-registrationrenred-settingsrender
Mar 9, 2023
Merged

Add openedx-filters hook to account settings before rendering it context#31295
mariajgrimaldi merged 6 commits into
openedx:masterfrom
eduNEXT:hpg/add-filters-hook-registrationrenred-settingsrender

Conversation

@Henrrypg

@Henrrypg Henrrypg commented Nov 16, 2022

Copy link
Copy Markdown
Contributor

Description

This PR introduces a new openedx-filters hook:

  1. 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:

  • Users: Allow to get customized account settings.

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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 16, 2022
@openedx-webhooks

openedx-webhooks commented Nov 16, 2022

Copy link
Copy Markdown

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:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

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.

@Henrrypg
Henrrypg marked this pull request as ready for review November 18, 2022 14:58
@Henrrypg
Henrrypg marked this pull request as draft November 22, 2022 16:49
@Henrrypg
Henrrypg force-pushed the hpg/add-filters-hook-registrationrenred-settingsrender branch from 1c2110d to 0501284 Compare November 30, 2022 17:30
@Henrrypg Henrrypg changed the title Add openedx-filters hook to registration before rendering of form description and account settings before rendering it context Add openedx-filters hook to account settings before rendering it context Nov 30, 2022
@Henrrypg
Henrrypg marked this pull request as ready for review November 30, 2022 17:44
@mariajgrimaldi

mariajgrimaldi commented Dec 5, 2022

Copy link
Copy Markdown
Member

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

@Henrrypg

Henrrypg commented Dec 5, 2022

Copy link
Copy Markdown
Contributor Author

@mariajgrimaldi As you suggested, i opened a PR in openedx-filters-samples with a testing example. What do you think?

@mphilbrick211

Copy link
Copy Markdown

Hi @Henrrypg! Just seeing if you are planning to re-run the failing checks on this?

CC: @mariajgrimaldi for review.

@mphilbrick211 mphilbrick211 added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Dec 16, 2022
@Henrrypg

Copy link
Copy Markdown
Contributor Author

Hello @mphilbrick211, i was working first with openedx/openedx-filters#46, thats why the checks are failling.

@mariajgrimaldi mariajgrimaldi Dec 20, 2022

Copy link
Copy Markdown
Member

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 :)

@openedx-webhooks openedx-webhooks removed the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Dec 20, 2022
@mphilbrick211

Copy link
Copy Markdown

Hi @Henrrypg! Just checking in to see if you are planning to pursue this pull request?

@Henrrypg
Henrrypg force-pushed the hpg/add-filters-hook-registrationrenred-settingsrender branch 2 times, most recently from 5760e2c to 8b1c90a Compare January 24, 2023 20:43
@Henrrypg

Henrrypg commented Jan 24, 2023

Copy link
Copy Markdown
Contributor Author

Hello @mphilbrick211 @mariajgrimaldi i just pushed a commit with the changes requested by @mariajgrimaldi, unitests and fix the implementation.

@mariajgrimaldi mariajgrimaldi self-assigned this Jan 31, 2023
Comment thread openedx/core/djangoapps/user_api/accounts/settings_views.py Outdated
Comment on lines 82 to 85

Copy link
Copy Markdown
Member

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.

Comment thread openedx/core/djangoapps/user_api/accounts/tests/test_filters.py Outdated

Copy link
Copy Markdown
Member

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.

@mphilbrick211 mphilbrick211 added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Feb 1, 2023
@Henrrypg

Henrrypg commented Feb 17, 2023

Copy link
Copy Markdown
Contributor Author

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.

@mariajgrimaldi

mariajgrimaldi commented Feb 20, 2023

Copy link
Copy Markdown
Member

I'll check on this again tomorrow! After reviewing openedx/openedx-filters#46

@mphilbrick211 mphilbrick211 removed the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Feb 21, 2023
@mariajgrimaldi

Copy link
Copy Markdown
Member

@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 :)

@mariajgrimaldi

Copy link
Copy Markdown
Member

openedx-filters v1.2.0 was released already!

@Henrrypg

Henrrypg commented Mar 1, 2023

Copy link
Copy Markdown
Contributor Author

@mariajgrimaldi Sure! I'll work on this

@Henrrypg
Henrrypg force-pushed the hpg/add-filters-hook-registrationrenred-settingsrender branch from 53f81b8 to 87b9b4b Compare March 6, 2023 14:38
@Henrrypg

Henrrypg commented Mar 6, 2023

Copy link
Copy Markdown
Contributor Author

@mariajgrimaldi I rebased with master and eduNEXT/openedx-filters-samples#1 is already merged :)

@mariajgrimaldi

mariajgrimaldi commented Mar 7, 2023

Copy link
Copy Markdown
Member

These are the instructions I followed:

  • Install the latest openedx-filters package
  • Install openedx-filters-samples
  • Add the following settings to your environment:
OPEN_EDX_FILTERS_CONFIG = {
    "org.openedx.learning.student.settings.render.started.v1": {
        "fail_silently": False,
        "pipeline": [
            "openedx_filters_samples.samples.pipeline.StopAccountSettingsRender"
        ]
    }
}
  • Deactivate the account MFE (this filter applies just to the legacy account view)
  • Since the filter redirects to "", you should stay on the current page.

This looks good. The only thing that worries me is our maintenance plan for filters used in legacy pages. cc @felipemontoya

@mariajgrimaldi

Copy link
Copy Markdown
Member

@Henrrypg: can you please rebase with master and fix conflicts?

@Henrrypg
Henrrypg force-pushed the hpg/add-filters-hook-registrationrenred-settingsrender branch from 87b9b4b to 5cbceee Compare March 7, 2023 20:21
@Henrrypg

Henrrypg commented Mar 7, 2023

Copy link
Copy Markdown
Contributor Author

Is done @mariajgrimaldi, checks are failing because openedx-filters version in master

@mariajgrimaldi

Copy link
Copy Markdown
Member

@Henrrypg: can you bump openedx-filters to 1.2.0? that's the latest release which has the filter you're including

@felipemontoya

Copy link
Copy Markdown
Member

The only thing that worries me is our maintenance plan for filters used in legacy pages.

As a user of a filter what I would expect:

  • for the page is being removed, I am notified for one stable release
  • when possible, the filter is used in the new replacement page or the API that MFEs call for the same feature. Otherwise a different but equivalent filter exists for the replacement page.

Do you think one or both of those are applicable here?

@mariajgrimaldi

mariajgrimaldi commented Mar 8, 2023

Copy link
Copy Markdown
Member

As a user of a filter what I would expect:

  • for the page is being removed, I am notified for one stable release
  • when possible, the filter is used in the new replacement page or the API that MFEs call for the same feature. Otherwise a different but equivalent filter exists for the replacement page.

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

@Henrrypg
Henrrypg force-pushed the hpg/add-filters-hook-registrationrenred-settingsrender branch from 4107b3f to bec74b2 Compare March 8, 2023 17:42
@mariajgrimaldi

Copy link
Copy Markdown
Member

@Henrrypg: I'll approve once tests pass :). Let me know!

@Henrrypg

Henrrypg commented Mar 8, 2023

Copy link
Copy Markdown
Contributor Author

@mariajgrimaldi Is ready to test now :)

@Henrrypg
Henrrypg force-pushed the hpg/add-filters-hook-registrationrenred-settingsrender branch from e8ea4d3 to 776e65b Compare March 9, 2023 14:49
@Henrrypg

Henrrypg commented Mar 9, 2023

Copy link
Copy Markdown
Contributor Author

@mariajgrimaldi i just rebased and checks are passing :)

@mariajgrimaldi mariajgrimaldi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@mariajgrimaldi
mariajgrimaldi merged commit d7ca7c1 into openedx:master Mar 9, 2023
@openedx-webhooks

Copy link
Copy Markdown

@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-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

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

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants