Repository navigation
Posts: hand the bulk-actions and columns filters the window mode - #856
Merged
AllTerrainDeveloper merged 2 commits intoOct 9, 2026
Merged
Conversation
A plugin action that only makes sense for posts painted its button
in the Pages window too: `openstation.postsWindow.bulkActions` got
the defaults array and nothing else, though `defaultBulkActions()`
right above it already held the mode. The only way to keep the
action out was at `run()` time, by walking `ctx.body` for the
`desktop-mode-pages` root class and refusing with a toast.
`resolveBulkActions()` now takes the mode and passes `{ mode }` as
the filter's second argument, `'posts' | 'pages'`; the columns
filter gets the same from the cell env. A callback that reads only
the first argument is unchanged. Documented in the hooks reference
and the native-posts example.
Fixes WordPress#854
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Collaborator
|
Thanks @juanlentino. We've been a bit busy. Going back to contributors now! |
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.
Fixes #854.
The problem
openstation.postsWindow.bulkActionswas applied with the defaults array and nothing else, thoughdefaultBulkActions( mode )right above it already held the mode. A plugin action that only makes sense for posts therefore painted its button in the Pages window too, and the only way to keep it out was atrun()time, by walkingctx.bodyfor the undocumenteddesktop-mode-pagesroot class and refusing with a toast: a button the window shows and then declines.The change
resolveBulkActions( defaults, mode )passes{ mode }('posts' | 'pages') as the filter's second argument; the columns filter gets the same from the cell env, sincebuildAllColumnsalready had it in hand.wp.hookspasses extra arguments positionally, so a callback that reads only the first argument is unchanged.statusSegmentsis untouched (no mode in scope there).{ mode: 'posts' }then{ mode: 'pages' }, and a one-arg callback in the same chain still returns the list (throughcreateHooksStub()). Red against trunk on the assertion.docs/hooks-reference.mdname the second argument;docs/examples/native-posts.mdshows the pages-aware callback.npm run build:apps,lint,test:js(6317 passed),typecheckall green.Found while adding a posts-only bulk action from a plugin, which had to read the window's DOM to tell the two modes apart.
🤖 Generated with Claude Code