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

PLANET-7645: Implement image replacement feature #2410

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

mardelnet
Copy link
Contributor

@mardelnet mardelnet commented Oct 16, 2024

Ref: https://jira.greenpeace.org/browse/PLANET-7645


DESCRIPTION:
This PR is the first of a series in an attempt to implement a media replacement feature.
This PR replaces images from the Media Library, including the entire set of related images (thumbnail, medium, custom, etc.), while keeping the original files' name ONLY in the uploads folder (not in Google Storage yet).


TESTING (local env only):

  1. Go to the Media Library page: /wp-admin/upload.php
  2. Select the image to replace.
  3. Click on the Replace Media button.
  4. Wait for the page to reload.
  5. Check that the whole set of related images in the planet4/uploads folder was replaced.

NOTES:
As this task seems complex, I plan to split it into multiple PRs and follow these steps:

  1. Replace images in the uploads folder (done in this PR).
  2. Implement a mechanism to purge the CDN service.
  3. Replace the files in Google Storage (wp-stateless).
  4. Add automated tests.
  5. Implement the replacement feature for the rest of the file types (videos, documents, etc.)

- Add basic implementation
- Add ajax call for the replacement
- Upload file from computer
- Separate JS logic in a different file
- Replace elements by name
- Code refactor and cleanup
@mardelnet mardelnet force-pushed the PLANET-7564_media-replacement-feature branch from 9402e8d to 0eda77b Compare October 16, 2024 11:33
planet-4 added a commit to greenpeace/planet4-test-pandora that referenced this pull request Oct 16, 2024
/unhold 12a5a81e-db53-4701-8798-b331dbc80589
@planet-4
Copy link
Contributor

Test instance is ready 🚀

🌑 pandora | admin | blocks report | CircleCI | composer-local.json

⌚ 2024.10.16 11:43:24

@mardelnet mardelnet changed the title PLANET-7564: Implement media replacement feature (part 1) PLANET-7564: Implement media replacement feature (part 2) Oct 21, 2024
@mardelnet mardelnet changed the title PLANET-7564: Implement media replacement feature (part 2) PLANET-7654: Implement image replacement feature Oct 23, 2024
@mardelnet mardelnet changed the title PLANET-7654: Implement image replacement feature PLANET-7645: Implement image replacement feature Oct 23, 2024
@mardelnet mardelnet added the HOLD label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants