Skip to content

Delete only the chart's own image when the image changes - #1425

Open
vytisbulkevicius wants to merge 1 commit into
developmentfrom
bugfix/pro/653
Open

vytisbulkevicius wants to merge 1 commit into
developmentfrom
bugfix/pro/653

Conversation

@vytisbulkevicius

Copy link
Copy Markdown
Contributor

A chart can keep a copy of itself as an image in the Media Library. When the image changes, the plugin now deletes only the image file that belongs to that chart, and the save request needs its nonce.

What changed

  • Chart image save — the request that stores a new chart image must carry a valid nonce. A request without one stores nothing.

  • Old chart image — the earlier attachment is deleted only when its file is visualization-<chart id>.png. Any other attachment stays in the Media Library.

Note

Tracked in Codeinwp/visualizer-pro#653.

QA

  1. Go to WP Admin → Visualizer → Chart Library and edit a chart. Open Settings → General → Save chart as an image inside Media Library, turn on Save inside media library? and save the chart.

    Expect: WP Admin → Media shows one image named visualization-<chart id>.

  2. Edit the same chart, change its title and save it again.

    Expect: WP Admin → Media still shows one image for the chart, and no other media item is gone.

🤖 Generated with Claude Code

The old image was deleted by the ID in the chart meta, whatever that ID named.
An image save also needs the editor nonce now.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for 3944494 is ready 🛎️!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants