Thanks for this module! It really helps making workbench moderation a more complete solution.

There are a couple of places that add a transition to the log with no real place to enter a log message. Maybe we can hijack these callbacks/forms so it is possible to add a log message here as well:

  • node/%node/moderation/%/unpublish
  • node/%node/moderation/%/change-state/%
  • node/%node/revisions/%/revert

Another logical thing could also be that a submit handler is added to the node form, so the revision log message is copied to the note field.

I will try to create a patch for this. Please let me know if there is anything wrong with this approach.

Comments

seanb’s picture

Assigned: Unassigned » seanb
Status: Active » Needs review
StatusFileSize
new8.92 KB

It actually was not that hard to add these. The patch is attached. The following was changed:

node/%node/moderation/%/unpublish
This path was changed through a form alter, the same way the workbench_moderation_moderate_form is changed.

node/%node/moderation/%/change-state/%
For this I created a custom callback which includes the workbench_moderation_moderate_form. I added the state to the callback so the default state is already selected. An argument could be made to hide the state field if we already know what it needs to be?

node/%node/revisions/%/revert
This transition message was added because hook_node_update is triggered for new revisions. Which is also triggered when you use the node add / edit form to add transitions to the log. By adding a hook_node_update to copy the revision log message to the note field in the transition log, I was able to solve both.

The transition log now always has all latest messages. I use this to create a custom view for the moderation overview.
Maybe with this in place it would be better to show a list of all the transitions on the moderation overview in stead of showing all revisions. The revision log message could be hidden and replaced by the note field?

scalp’s picture

Thanks for the patch seanB. It does what it says.

seanb’s picture

Thanks for the review! I actually changed some small things so I will post an updated patch tomorrow. The reason for this is that the trick of writing to the log doesn't take the new state in to account.

I used hook_workbench_moderation_transition() to do an automatic transition in some cases, and the note message would be added to the automatic state change and not the manual one. Adding a check for the new state solves this (in most cases it is still kind of hacky).
I also added a helper function to write the notes to the DB, so I could use this function to provide a extra log message for my automatic state change. This also helped me remove some duplicate code.

New patch is coming, hope you can take a look :)

seanb’s picture

As promised a new patch. Let me know if it works!