Skip to content

Conversation

@dcoa
Copy link
Contributor

@dcoa dcoa commented Oct 27, 2025

Description

This PR creates a toggle component that updates the library metadata to allow public read. This to keep compatibility with the current functionality in Libraries Manage team modal.

Behavior

  • With manage team, The user can turn the toggle On/Off. When the save succeeds, a toast is displayed.
  • Without manage team and toggle Off, the user does not see the toggle.
  • Without manage team and toggle On, the user sees it but cannot change it.

Extra information

Evidence

Manage Team Permissions

image

Only View Permissions

  • Toggle On
image
  • Toggle off
image

Test Instructions

  • Have a instance with https://github.com/openedx/openedx-authz Django Plugin
  • Load the policies in the lms container with "./manage lms load_policies"
  • Create a library
  • Use http://local.openedx.io:8000/api-docs/#/ to grand roles.
  • Add 2 users to the library team one with library_admin role and the other one with library_user role
  • Test the admin can see and edit the toggle.
  • Test the user can see the toggle when is enable and not see the toggle when the feature is disabled.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Oct 27, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @dcoa!

This repository is currently maintained by @openedx/committers-frontend.

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.

Details
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.

@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

❌ Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.14%. Comparing base (8dc3139) to head (1ce31ac).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
.../libraries-manager/components/PublicReadToggle.tsx 88.88% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #25      +/-   ##
==========================================
+ Coverage   93.86%   94.14%   +0.27%     
==========================================
  Files          43       44       +1     
  Lines         799      837      +38     
  Branches      159      169      +10     
==========================================
+ Hits          750      788      +38     
- Misses         46       47       +1     
+ Partials        3        2       -1     

☔ 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.

@dcoa dcoa force-pushed the dcoa/toggle-plublic-read branch from 7fcea7f to 9d73b3d Compare October 27, 2025 05:45
@dcoa dcoa force-pushed the dcoa/toggle-plublic-read branch from 9d73b3d to b387aba Compare October 27, 2025 05:48
@dcoa dcoa moved this to Ready for review in RBAC AuthZ Board Oct 27, 2025
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Oct 27, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Oct 27, 2025
Copy link

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

Overall this looks great!

I left one comment with a change request that I consider blocking, but the rest of the comments don't need to be addressed for this to land.

Thank you so much for all the great work on this!

'libraries.authz.public.read.toggle.success': {
id: 'libraries.authz.public.read.toggle.success',
defaultMessage: 'The library setting has been updated successfully.',
description: 'Sucessfull message for allow public read',

Choose a reason for hiding this comment

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

Suggested change
description: 'Sucessfull message for allow public read',
description: 'Success message for allow public read',

});
});

describe('useUpdateLibrary', () => {

Choose a reason for hiding this comment

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

These tests appear to only be testing that the title can be updated properly. Not blocking, but it'd be nice to have tests verifying each part of LibraryMetadata that can be updated via this endpoint is updated properly.

Copy link

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

I noticed some strange behavior with the divider after pulling latest and testing locally

Starting large

Screencast.From.2025-10-28.13-40-22.mp4

Starting small

Screencast.From.2025-10-28.13-41-26.mp4

Copy link

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines 43 to 45
const { width = window.innerWidth } = useWindowSize();
const minWidth = breakpoints.large?.minWidth || 1200;
const isDesktop = width > minWidth;

Choose a reason for hiding this comment

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

I'm not a huge fan of needing to do this, but I'm OK with it as a workaround.

I tried digging into why useMediaQuery wasn't responding to resizes and it's very strange. In my testing it even seemed to work as expected sometimes but not all, so it really isn't making sense to me.

I know Paragon just passes through useMediaQuery from react-responsive, but I couldn't find any issues on that repo that seemed to match what we're seeing here.

I made a Paragon issue to track this openedx/paragon#3958

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like installing react-responsive directly works, but not sure why using the imported version for Paragon does not behaves correctly.

I'm happy to install the library for better workaround, if you agree.

Choose a reason for hiding this comment

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

It looks like Paragon's version of react-responsive was updated to v10 in openedx/paragon#3895, which released in Paragon 23.14.8.

This MFE is using 23.14.2

"node_modules/@openedx/paragon": {
"version": "23.14.2",

Does it work if you update the version of Paragon this MFE is using to ^23.14.8?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does!! 🎉

@dcoa dcoa force-pushed the dcoa/toggle-plublic-read branch from 29289d8 to 1ce31ac Compare October 29, 2025 19:00
Copy link

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

Re-approving with the Paragon bump fixing useMediaQuery!

@brian-smith-tcril brian-smith-tcril merged commit 9fef270 into openedx:master Oct 29, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from Ready for review to Done in RBAC AuthZ Board Oct 29, 2025
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Contributions Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants