Add patchable functions to allow mutating otherOperations arrays

Describe the feature you’d like

Currently the following components have hardcoded initialisation of their otherOperations arrays:

  • GalleryList
  • GalleryAddPanel
  • GalleryImagesPanel
  • GroupList
  • GroupSubGroupsPane
  • ImageList
  • PerformerList
  • SceneList
  • SceneMarkerList
  • StudioList
  • TagList

These arrays are used to populate the menu items hidden behind the … button.

I view this menu as a perfect place to allow plugins to add their own operations, without invasive additions to the page. Therefore, I propose that after the hardcoded initialisation of these arrays, these components should call a patchable function to allow plugins to mutate the arrays.

Describe the benefits this would bring to existing users

  • Make it substantially easier for plugin developers to provide buttons which run custom functionality
  • Reduced risk of conflicts between plugins that add custom UI
  • A more consistent interface for users with plugins installed

Is there an existing way to achieve this goal?

Yes, I have already extended this menu in my Group Management plugin. But doing so required a disgusting hack that will probably break in future versions of Stash.

Adding a patchable function for this would make this much less fragile.

Additional context

Related PR: Add more patchable components by WithoutPants · Pull Request #6404 · stashapp/stash · GitHub

Will be going into 0.30.

1 Like