Skip to content

Posts window: the bulkActions filter receives no mode, so a plugin cannot keep a posts-only action out of the Pages window #854

Closed

Description

@juanlentino

What

openstation.postsWindow.bulkActions is applied as applyFilters( HOOK_FILTER_BULK_ACTIONS, defaults ) in resolveBulkActions( defaults ) (apps/posts/parts/columns.ts, trunk 6fd8d43a, 1.1.10). The defaults builder right above it takes mode: 'posts' | 'pages' and words its own confirm by it, but the filter callback gets only the array: no mode, no ctx. The filter is resolved once per window on the first bulk-bar paint.

A plugin registering an action that only makes sense for posts (say a scheduler that refuses core's publish and unpublish boundaries) therefore paints the button in the Pages window too. The only way to keep it out is at run() time, where ctx.body is available: we walk it for the undocumented desktop-mode-pages root class and refuse with a toast, and the server refuses pages regardless. That leaves a button the window shows and then declines.

Ask

Pass the mode to the filter, in the shape the columns filter or the status-segments filter would also benefit from, for example applyFilters( HOOK_FILTER_BULK_ACTIONS, defaults, { mode } ). Documenting the root class as the Pages discriminator would be a smaller step; the filter argument is the clean one, since defaultBulkActions( mode ) already has it in hand.


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. Happy to take it: #856 passes the mode.

Activity

  1. added a commit that references this issue on Oct 9, 2026
    36f5170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions