Skip to content

Add openedx-filters hook to VerticalBlock before rendering of child blocks#30773

Merged
mtyaka merged 1 commit intoopenedx:masterfrom
open-craft:tecoholic/add-filter-hook-to-vertical-block-rendering
Aug 23, 2022
Merged

Add openedx-filters hook to VerticalBlock before rendering of child blocks#30773
mtyaka merged 1 commit intoopenedx:masterfrom
open-craft:tecoholic/add-filter-hook-to-vertical-block-rendering

Conversation

@tecoholic
Copy link
Contributor

@tecoholic tecoholic commented Jul 23, 2022

Description

Supersedes #30650

This PR introduces a new openedx-filters event org.openedx.learning.vertical_block_child.render.started.v1 hook in the platform at xmodule/vertical_block.py. This is implemented as a part of the effort to implement "Edit Link" in the course content for Open Source courses stored in OLX format.

Users impacted by the change:

  • "Students"
  • This doesn't introduce any changes to the UI or the VerticalBlock's rendering by itself. It provides a way to hook into the vertical block's rendering process that the plugins implementing the filter can use to introspect the child blocks and the rendering context and perform operations.

Supporting information

No direct openedx related ticket is available. Related tickets that add context to this change are:

Testing instructions

The change can be tested as a part of testing the openedx-edit-links plugin

Deadline

"None"

Other information

Once accepted, this should be merged only after openedx/openedx-filters#38 is merged and the requirements are updated.

Settings

EDXAPP_EXTRA_REQUIREMENTS:
  - name: git+https://github.com/open-craft/openedx-edit-links.git@tecoholic/BB-6206-edit-links-poc

@openedx-webhooks
Copy link

openedx-webhooks commented Jul 23, 2022

Thanks for the pull request, @tecoholic! 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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 23, 2022
@tecoholic tecoholic marked this pull request as draft July 23, 2022 18:46
@tecoholic tecoholic force-pushed the tecoholic/add-filter-hook-to-vertical-block-rendering branch 2 times, most recently from 176c5f1 to 986d1dd Compare July 24, 2022 04:22
@tecoholic tecoholic force-pushed the tecoholic/add-filter-hook-to-vertical-block-rendering branch 2 times, most recently from f263364 to 948c311 Compare July 24, 2022 09:32
@tecoholic tecoholic marked this pull request as ready for review July 24, 2022 15:04
@tecoholic
Copy link
Contributor Author

@bradenmacdonald Can you kindly take a look at this when you have some time?

@natabene
Copy link
Contributor

@tecoholic Thank you for your contribution. Please let me know once this is ready for our review.

@tecoholic
Copy link
Contributor Author

@natabene This is ready for review. The Javascript test failing seems unrelated to the change. I will try to get a rerun.

@bradenmacdonald
Copy link
Contributor

@tecoholic Sure, I can review this, probably next week.

@tecoholic
Copy link
Contributor Author

@bradenmacdonald That's great. Thank you.

@pomegranited
Copy link
Contributor

Thank you for reviewing here @bradenmacdonald ! FYI the OC task is BB-6457.

@bradenmacdonald
Copy link
Contributor

@tecoholic The code looks good and seems consistent with some of the other hooks. Is there a sandbox where it can be tested?

I also left some comments on open-craft/openedx-edit-links#1 - I think the comment about wrapping get_html instead of using a private XBlock method is important; the others are optional.

@tecoholic
Copy link
Contributor Author

@bradenmacdonald Thank you for reviewing this. Wrapping the get_html function is a much cleaner solution. I tried to setup a sandbox with the settings specified in the PR. It didn't deploy. I will get it setup and let you know so that you can see the full solution in action.

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

Looks great to me, thanks! Approved. You will however need to rebase it and update the "openedx-filter" dependency before this can be merged.

👍

  • I tested this: on the provided sandbox at https://app.pr30773.sandbox.opencraft.hosting/
  • I read through the code
  • I checked for accessibility issues: n/a, backend only
  • Includes documentation - that's being discussed in the filters PR

This commit adds a openedx-filters hook to the VerticalBlock XBlock
before rendering of it's children. This allows Open edX plugins to
customize the presentation of specific blocks based on the context.
@tecoholic tecoholic force-pushed the tecoholic/add-filter-hook-to-vertical-block-rendering branch from 341fb42 to 6867d55 Compare August 20, 2022 07:39
@tecoholic
Copy link
Contributor Author

@bradenmacdonald Thank your for the review and the approval.

@pomegranited I have update the PR:

  • rebased it to the master branch
  • removed the temp commits with custom pinned openedx-filters branches and set the version to 0.8.0 which has the filter merged
  • Added the new filter to the documentation with the date set to the merge date of the filters PR merge and the link pointing to the location of filter hook once this PR is merged
  • squashed everything into a single commit

Kindly give it a look and merge it if everything looks to be in place.

@pomegranited
Copy link
Contributor

Hi @tecoholic , thanks for the ping :) I'm not a core committer on edx-platform so I can't merge this for you.
@pkulkark @mtyaka @Agrendalath or @giovannicimolin , could you lend a hand here?

CC @bradenmacdonald

@mtyaka
Copy link
Contributor

mtyaka commented Aug 23, 2022

@pkulkark @mtyaka @Agrendalath or @giovannicimolin , could you lend a hand here?

I can take a look.

@mtyaka mtyaka merged commit a5bc75c into openedx:master Aug 23, 2022
@openedx-webhooks
Copy link

@tecoholic 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@Agrendalath Agrendalath deleted the tecoholic/add-filter-hook-to-vertical-block-rendering branch August 23, 2022 15:31
@edx-pipeline-bot
Copy link
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
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.

7 participants