Skip to content
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

feat: extend the profile fields with the already existing extended_profile_fields #1167

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bra-i-am
Copy link

@bra-i-am bra-i-am commented Feb 17, 2025

Description

This PR aims to allow the extension of the default profile fields by using the extended_profile_fields feature with a custom form app like the example

Main changes

  • src/profile/forms/ExtendedProfileFields.jsx: New component to manage the fields added to the extended_profile_field settings attribute (it is only covered checkbox, text and select fields)
  • src/profile/data/services.js: Add a service to retrieve all the extended profile field properties (these are added with the custom form app and retrieved to the MFE with the mfe_context API)
  • src/profile/data/selectors.js: Add the fieldValues from the extended_profile account prop to the extended_profile_fields attributes since the data is fetched

How Has This Been Tested?

  1. Init a Sumac environment
  2. Git clone and mount this MFE with tutor mounts add /path/to/cloned/mfe
  3. Git clone this custom form app which counts with checkbox, select and text fields
  4. Mount the custom form app with tutor mounts add lms:/path/to/cloned/custom-form-app:/openedx/extra-deps and install it using tutor dev exec lms pip install -e ../extra-deps/custom-form-app
  5. Add the following env variables
    # lms.env.yml
    ADDL_INSTALLED_APPS:
      - "custom_reg_form"
    ENABLE_COMBINED_LOGIN_REGISTRATION: true
    REGISTRATION_EXTENSION_FORM: "custom_reg_form.forms.ExtraInfoForm"
    
    # cms.env.yml
    ENABLE_COMBINED_LOGIN_REGISTRATION: true
  6. Add the following settings to the Site Configurations > local.openedx.io:8000:
    {
        "ENABLE_DYNAMIC_REGISTRATION_FIELDS": true,
        "MFE_CONFIG": {
            "ENABLE_DYNAMIC_REGISTRATION_FIELDS": true,
        },
        "extended_profile_fields": [
            "employment_situation",
            "allow_newsletter",
            "favorite_movie",
            "data_authorization"
        ]
    }
  7. Run tutor dev restart
  8. When you go to your profile (Profile MFE), you'll interact with the extended fields added through the custom form app

Screenshots/sandbox (optional):

image
image

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 17, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Feb 17, 2025

Thanks for the pull request, @bra-i-am!

This repository is currently maintained by @openedx/2u-infinity.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

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

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


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

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@bra-i-am bra-i-am force-pushed the bc/add-extended-profile-fields branch from 5503f7a to 177091e Compare February 17, 2025 16:27
@bra-i-am bra-i-am changed the base branch from open-release/redwood.master to master February 17, 2025 16:28
@bra-i-am bra-i-am marked this pull request as ready for review February 17, 2025 19:30
@bra-i-am bra-i-am requested a review from a team as a code owner February 17, 2025 19:30
@bra-i-am bra-i-am changed the title [WIP] feat: allow to extend the profile fields with the extended_profile_fields feat: extend the profile fields with the already existing extended_profile_fields Feb 17, 2025
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Feb 19, 2025
@e0d
Copy link

e0d commented Feb 21, 2025

@bra-i-am looks like there are some failing tests, can you have a look?

Also, I've invited you to the triage team which will allow tests to run automatically. Please accept that invite.

@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Feb 21, 2025
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
Status: No status
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

4 participants