Repository navigation
A form can be deleted — and the Trash gives it back - #44
Merged
Merged
Conversation
There was archiving, for a form whose moment has passed, and there was
no way at all to be rid of one that should never have existed. The
server has known how since the beginning -- DELETE /forms/{id} trashes
the form and fires alltfo_form_deleted -- but nothing in the builder
ever called it.
Now the Settings pane pairs the Archive section with a Delete one: a
danger button, a confirmation that says exactly what will happen, and
the same landing the archive uses -- the next form if there is one, the
empty state if not. The entries deliberately stay, because they are the
visitors' words rather than the form's, and the trash rather than a
hard delete means a wrong click is a support request, not a loss.
And the part nobody had noticed: a trashed form kept rendering. Both
public gates -- the renderer and the submission pipeline -- checked the
post type and never the status, so "deleted" meant "gone from the
lists" while every shortcode still showed the form and accepted its
answers. Both now treat trash as nonexistence, and three new tests hold
the door shut: silent render, refused POST, surviving entries.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp
Deleting worked; changing your mind did not. Two bugs stood between a trashed form and the desktop's Trash window, one in each plugin. On this side: the form post type is headless, so OpenStation's bin does not track it by itself — it is now opted in through `openstation_recycle_bin_capture_post_types`. Forms only, deliberately: retention trashes entries in bulk every day, and a bin full of expired entries would bury the one form somebody actually wants back. And the capability map was two primitives short. Our own REST asks `alltfo_edit_forms` and never WordPress's `edit_post`, but everything outside the plugin asks the standard question — and on a form trashed from publish, `edit_post` resolves to `edit_published_alltfo_forms`, which no role held. The bin dutifully hid every trashed form from the administrator who had just trashed it. Both `_published_` primitives are granted now, for forms and entries alike, and a test asks the standard question so the next missing primitive cannot hide. The builder's delete copy now tells the whole story too: the form moves to the desktop's Trash, and it can be brought back from there. (The other half — the bin's config never reaching its lazy-loaded bundle — is fixed in the desktop-mode repo, branch fix/lazy-window-config-priority.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp
Deleting a form updated the open Trash window a heartbeat late — fifteen to sixty seconds, which reads as never. The shell cannot see a mutation made through this plugin's own REST endpoints; the moment the delete resolves, the builder now says so itself through the shell's new `wp.os.announceContentChange()`, and the Trash window and its dock badge repaint before the toast has faded. (The announcer is OpenStation PR #656, which also carries the lazy-config fix that made the Trash window list anything at all.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the missing way to delete a form, and makes the desktop's Trash a real safety net for it:
wp_trash_post, not a hard delete.openstation_recycle_bin_capture_post_types(forms only; retention bulk-trashes entries and would bury the bin), and the capability map gains theedit_published_/delete_published_primitives that WordPress's standardedit_post/delete_postmeta caps resolve to on a trashed-from-published form — without them the bin silently hid trashed forms from administrators.wp.os.announceContentChange()(Trash: localize config before the lazy payload harvest WordPress/openstation#656), so an open Trash window and the dock badge repaint immediately instead of on the 15–60 s Heartbeat cadence.Verification: 732 PHPUnit + 372 vitest green, PHPCS clean; QA'd end to end on the 8889 site — delete from the builder, watch the open Trash list it as "now", restore it back to its pre-trash status.
🤖 Generated with Claude Code
https://claude.ai/code/session_0119U4sRRWGcTQdwYreTwpAp