Skip to content

refactor: conditionally render Replace video button & fix redirection URLs #1915

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

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

Conversation

bra-i-am
Copy link
Contributor

@bra-i-am bra-i-am commented May 6, 2025

Description

Fix the error that makes the page go blank after clicking the Replace video button.

With some frequent changes, the page does not go blank, but the Replace video button closes the modal without redirecting to the video gallery view. This PR adds the prefix /authoring/ to some URLs, which caused the page to go blank after clicking Replace video. On the other hand, taking into account the comment #1540 (comment) , it fetches the waffle flags so it can check and render the button Replace video conditionally.

Supporting information

openedx/wg-build-test-release#418

Testing instructions

  1. Add a new video component.
  2. Edit the component
  3. Click the 'replace video' button.

Evidence

Before

The button Replace video appears, but it does nothing; it only closes the modal
Screencast from 07-05-25 17:08:13.webm

After

The button Replace Video can be hidden or shown by changing the WaffleFlag contentstore.new_studio_mfe.use_new_video_uploads_page; now, when the flag is on, the user is redirected to the video gallery view
Screencast from 07-05-25 17:09:22.webm

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

openedx-webhooks commented May 6, 2025

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

This repository is currently maintained by @bradenmacdonald.

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.

Copy link

codecov bot commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.03%. Comparing base (d806b61) to head (57b5dc4).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1915      +/-   ##
==========================================
+ Coverage   94.00%   94.03%   +0.02%     
==========================================
  Files        1154     1154              
  Lines       24232    24244      +12     
  Branches     5263     5248      -15     
==========================================
+ Hits        22780    22798      +18     
+ Misses       1375     1369       -6     
  Partials       77       77              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bra-i-am bra-i-am force-pushed the bc/fix-replace-video-btn branch from 8c7a398 to ef23d37 Compare May 7, 2025 21:46
@bra-i-am bra-i-am changed the title fix: update navigation paths to include 'authoring' prefix refactor: conditionally render Replace video button & fix redirection URLs May 8, 2025
@bra-i-am bra-i-am force-pushed the bc/fix-replace-video-btn branch from 7481120 to 4c704c4 Compare May 8, 2025 20:36
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions May 12, 2025
@mariajgrimaldi
Copy link
Member

Can we get some help reviewing this, @openedx/2u-tnl? This is a 2U specific feature we're trying to fix and also put behind the respecting flag so it's off in the community sandbox environment.

@mphilbrick211
Copy link

Can we get some help reviewing this, @openedx/2u-tnl? This is a 2U specific feature we're trying to fix and also put behind the respecting flag so it's off in the community sandbox environment.

Friendly ping on this @openedx/2u-tnl - thanks!

@mphilbrick211 mphilbrick211 moved this from Waiting on Author to Ready for Review in Contributions May 27, 2025
@Faraz32123
Copy link
Contributor

Hi @bra-i-am, can you rebase the branch, so that CI passes. As a PR was merged recently related to codecov.

@@ -23,7 +24,7 @@ export const hooks = {
useReturnToGallery: () => {
const learningContextId = useSelector(selectors.app.learningContextId);
const blockId = useSelector(selectors.app.blockId);
return () => (navigateTo(`/course/${learningContextId}/editor/course-videos/${blockId}`));
return () => (navigateTo(`/authoring/course/${learningContextId}/editor/course-videos/${blockId}`));
Copy link
Contributor

@bradenmacdonald bradenmacdonald May 30, 2025

Choose a reason for hiding this comment

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

Putting /authoring/ in here should not be necessary - all the URLs used with react-router should be relative to this app (e.g. starting with /course/), and the /authoring/ part is automatically added by this line.

Also, it should never be hard-coded. For example, on edx.org they don't use /authoring/ - they use a separate domain for each MFE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bradenmacdonald,

I added the /authoring/ because the redirection in different places worked incorrectly for me due to the navigateTo function used there; it is not using react-router but window.location directly.

Screencast.from.03-06-25.16.14.35.webm

However, taking into account that (according to what I understand) the redirection of the Replace video button is a 2U-specific feature, and you said:

on edx.org they don't use /authoring/ - they use a separate domain for each MFE.

Now it makes sense why the prefix is skipped.

Thank you so much for your review and your explanation. I'm sending the proper modifications ✨

@@ -14,7 +14,7 @@ export const {
export const postUploadRedirect = (storeState, uploadType = 'selectedVideoUrl') => {
const learningContextId = selectors.app.learningContextId(storeState);
const blockId = selectors.app.blockId(storeState);
return (videoUrl) => navigateTo(`/course/${learningContextId}/editor/video/${blockId}?${uploadType}=${videoUrl}`);
return (videoUrl) => navigateTo(`/authoring/course/${learningContextId}/editor/video/${blockId}?${uploadType}=${videoUrl}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here - don't hard-code /authoring/ and you shouldn't actually need it at all.

@bradenmacdonald
Copy link
Contributor

bradenmacdonald commented May 30, 2025

@mariajgrimaldi TNL at 2U has pretty limited availability for reviews these days. Is there any specific questions we can ask that would help them review this faster?

@bra-i-am bra-i-am force-pushed the bc/fix-replace-video-btn branch from 4c704c4 to 5ce9168 Compare June 3, 2025 21:46
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: Ready for Review
Development

Successfully merging this pull request may close these issues.

[Test failure] TC_AUTHOR_49: When the replace video button is clicked, the page goes blank.
6 participants