-
Notifications
You must be signed in to change notification settings - Fork 132
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, @bra-i-am! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1915 +/- ##
==========================================
+ Coverage 94.08% 94.16% +0.08%
==========================================
Files 1164 1164
Lines 24475 24557 +82
Branches 5187 5339 +152
==========================================
+ Hits 23027 23125 +98
+ Misses 1380 1355 -25
- Partials 68 77 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8c7a398
to
ef23d37
Compare
Replace video
button & fix redirection URLs
7481120
to
4c704c4
Compare
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! |
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}`)); |
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.
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.
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 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}`); |
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.
Same thing here - don't hard-code /authoring/
and you shouldn't actually need it at all.
@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? |
4c704c4
to
5ce9168
Compare
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.
const RootWrapper = ({ ...props }) => ( | ||
<AppProvider store={store}> | ||
<IntlProvider locale="en"> | ||
<VideoSettingsModal {...defaultProps} {...props} /> | ||
</IntlProvider> | ||
</AppProvider> | ||
); | ||
|
||
describe('<VideoSettingsModal />', () => { | ||
beforeEach(async () => { | ||
initializeMockApp({ | ||
authenticatedUser: { | ||
userId: 3, | ||
username: 'abc123', | ||
administrator: true, | ||
roles: [], | ||
}, | ||
}); | ||
window.scrollTo = jest.fn(); | ||
global.localStorage.clear(); | ||
store = createStore(); | ||
}); |
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.
For new tests, it's better to use testUtils
- see #2067 . The other new test files you've added look fine; just this one has more boilerplate than you need.
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.
@bradenmacdonald, I just updated this merge request, addressing your comments
I had to apply some modifications to initializeMocks
because the redux state shape changes in the editors
folder: to avoid errors creating the store when running the tests, I allowed adding a custom store creator
I look forward to your feedback! Thanks
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.
Thanks! I think I would slightly prefer that we do it this way: open-craft@a1be315 - what do you think?
Just because I want to keep the reducer in testUtils
related to the "main" redux state, and have the editor-specific test code in the editorTestRender
file.
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.
Thanks for your recommendation! ✨
I also believe it's a better approach and have already applied the changes (I tried to cherry-pick them, but I don't know why I couldn't).
@bradenmacdonald: I'm not very familiar with this feature, so I'm not sure what we should ask during this specific review. That said, independently of the nature of this specific fix, I think we could start encouraging PR authors to include a short summary of the triage discussions and how we got to the current solution. As a reviewer who hasn’t been part of those earlier conversations, that kind of context in the PR would really help. I'd like to start reinforcing this during triage to make things easier for reviewers. Also, in cases like this, where we want to make sure we're not breaking any 2U-specific functionality but just adding conditions that can be used, I think it makes sense to ask how to ensure the behavior remains unchanged, and to proactively loop in the 2U team. I know this is probably obvious to everyone, but I still think it's worth mentioning just to make sure we're all on the same page. What else did you have in mind to improve these reviews? |
@mariajgrimaldi That's mostly what I had in mind - just looping them in and pointing them to the main issue(s) of concern for 2U so they can focus on testing that. |
…rModal and VideoSettingsModal
…fle_flags response in CourseUnit tests
57b5dc4
to
4fb2223
Compare
… and improve mock initialization
ef50c05
to
6406f8f
Compare
596e60c
to
785b306
Compare
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 clickingReplace video
. On the other hand, taking into account the comment #1540 (comment) , it fetches the waffle flags so it can check and render the buttonReplace video
conditionally.Supporting information
openedx/wg-build-test-release#418
Testing instructions
Evidence
Before
The button
Replace video
appears, but it does nothing; it only closes the modalScreencast from 07-05-25 17:08:13.webm
After
The button
Replace Video
can be hidden or shown by changing the WaffleFlagcontentstore.new_studio_mfe.use_new_video_uploads_page
; now, when the flag is on, the user is redirected to the video gallery viewScreencast from 07-05-25 17:09:22.webm