Moving allow public read switch from admin console#2942
Moving allow public read switch from admin console#2942arbrandes merged 2 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @jacobo-dominguez-wgu! 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. DetailsWhere 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. |
4833f18 to
cf67b56
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2942 +/- ##
=======================================
Coverage 95.51% 95.51%
=======================================
Files 1329 1330 +1
Lines 30557 30582 +25
Branches 6925 6927 +2
=======================================
+ Hits 29186 29211 +25
Misses 1303 1303
Partials 68 68 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
arbrandes
left a comment
There was a problem hiding this comment.
I tested this and it works as advertised, nice!
I have some concerns about the code, though, as seen below.
cf67b56 to
2413952
Compare
arbrandes
left a comment
There was a problem hiding this comment.
Thanks! A couple more observations inline below.
| onError: () => { | ||
| showToast(formatMessage(messages.publicReadToggleDefaultError)); | ||
| }, |
There was a problem hiding this comment.
Do we still need the onError, or is the catch() below enough?
There was a problem hiding this comment.
Yes we need both, onError catches errors like 400 and 500 errors and catch() handles JS runtime errors, React Query errors or network errors with no http status.
There was a problem hiding this comment.
I did some research, and it doesn't look like we need it. getAuthenticatedHttpClient() rejects the promise for any non-2xx status by default, so 400s and 500s will also be caught by .catch().
(Another way to look at it: if we did need an onError, then the rest of this codebase that uses mutateAsync would be missing it.)
There was a problem hiding this comment.
Good to know, I have removed the onError, thanks!
1632ab1 to
d40370f
Compare
Description
Adding the "Allow public read" switch into the sidebar on the library page.
This feature was moved from admin-console since we are also supporting courses there and it is not gonna be exclusive for libraries anymore.
Useful information to include:
Resolves #2925
PR removing feature on admin console: openedx/frontend-app-admin-console#99
Testing instructions
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'