Skip to content
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

Pattern Creation: Prevent uploads to the media library #373

Merged
merged 7 commits into from Nov 19, 2021

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Oct 28, 2021

Fixes #37There are over 100 images uploaded to the Pattern Directory, these have been verified CC0 and can be used in patterns. This PR removes the ability for users to upload to the site, but leaves the ability to open the media library to insert already-uploaded images.

This PR is laying the groundwork for #375. It disables uploads for non-admins, and sets up a button to open the media modal. In #375, this will be used to open our Openverse modal.

⚠️ This only applies to non-admins, admin & superadmin users can still upload media so that we can manage the media library, in case it's necessary.

❓ Specifically requesting reviews because I'm touching capabilities, if there's a better way to achieve this let me know.

Screenshots

When media blocks are inserted, they now just have "Pattern Media Library" as an option, for example the Gallery block:

custom-gallery

Media & Text:

Screen Shot 2021-10-28 at 2 20 41 PM

In the Media & Text block, only "Open Media Library" is available to replace the image.

custom-replace-flow

The Media Library itself still has the "Upload files" tab, but if you try to upload you get a permissions error:

Screen Shot 2021-10-28 at 2 21 51 PM

How to test the changes in this Pull Request:

  1. Try as various user levels (still need to be a user on the site to create patterns)
  2. Create a new pattern or edit an existing one
  3. Add any media block: Image, Gallery, Video, etc
  4. You should not be able to insert via URL
  5. You should not be able to upload your own file
  6. You should be able to insert existing media files into the pattern
  7. Play around with the pattern & blocks more - saving, editing, etc should all still work

@ryelle ryelle self-assigned this Oct 28, 2021
@ryelle ryelle added the [Component] Pattern Creator Anything related to the pattern front end editor or preview label Oct 28, 2021
@ryelle ryelle added this to the Pattern Creation milestone Oct 28, 2021
@shaunandrews
Copy link
Collaborator

Could we use the primary button styling and update the language to "Choose {mediaType}" or, if not possible (or specified), just "Media Library"?

image

@ryelle ryelle added this to In progress in Pattern Creation [i1] Nov 10, 2021
@ryelle ryelle force-pushed the update/restricted-media-library branch from 70d67c0 to 8cd72e3 Compare November 11, 2021 18:40
@ryelle
Copy link
Contributor Author

ryelle commented Nov 11, 2021

Updated to use the block label/media type for the title, and primary button style for the button.

Screen Shot 2021-11-11 at 1 39 53 PM

@ryelle ryelle marked this pull request as ready for review November 11, 2021 18:41
@ryelle ryelle mentioned this pull request Nov 11, 2021
7 tasks
@ryelle ryelle force-pushed the update/restricted-media-library branch from 1d04f73 to c2c5137 Compare November 19, 2021 17:26
@ryelle ryelle force-pushed the update/restricted-media-library branch from c2c5137 to ce8984f Compare November 19, 2021 18:21
@ryelle ryelle merged commit 936b29c into trunk Nov 19, 2021
@ryelle ryelle deleted the update/restricted-media-library branch November 19, 2021 20:02
@ryelle ryelle moved this from In progress to Done in Pattern Creation [i1] Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview
Development

Successfully merging this pull request may close these issues.

Create a library of media and only allow that to be used in patterns
2 participants