New Addon - Moderation for collections


Think is something that is missing on Cockpit when comparing with other headless solutions, the possibility to define a status on the contents and therefore affect the api calls. Resuming, let’s imagine we want to work on a post that is already visible in live (Published state) and we want to save our changes but without having them visible. So using the addon we can save as a Draft and the API will still return the previous published version.

The Addon provides a new field type (Moderation) that enhances the collection form page with a new option:


More details on the project repo:

During the implementation I faced two challenges:

  1. Having the sidebar item positioned on top of the list, the way I did it is a bit hacky (via javascript), but would be interesting if we could have a weight value that could be used to define the order of the items, or a new event on the sidebar so we can manipulate the items
  2. Get the latest revision that have a field with a specific value, I’m hooking into the collections.filter.after and if the field is present and value is draft, I load the revisions and iterate until find the correct one. It works well, but not sure if it can cause performance troubles.

Feedback appreciated.