Hey folks,

I had a need for a view of revisions that a user could moderate. I saw there was a handy sounding filter, Workbench Moderation: User Can Moderate, but was disappointed to see it had apparently just been stubbed out. I wrote a patch that should do as advertised, show only content the user can moderate. It does so by checking the permissions, and seeing which from states the user can access.

See below for patch.

Comments

wbobeirne’s picture

Status: Active » Needs review
StatusFileSize
new1.57 KB
hass’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
hass’s picture

hass’s picture

Status: Needs review » Needs work

Patch has several code style issues (trailing spaces).

elvis2’s picture

Status: Needs work » Needs review
StatusFileSize
new2.53 KB

Attached is a modification of this filter. Thanks wbobeirne for getting me started.

There are a couple of ways this filter could work.

  1. Based on the state of the draft
  2. Based on the transition

After doing some discovery I think the best method should be filtering based on the transition; This will only show content transitions the user has permissions to.

If you were to use a state base filter alone, you may not see any difference with a transition base filter if you have the out of the box workbench states (draft, review, publish) since there are just a few workbench transitions.

In our case, we have a few more states (new, draft, needs review, manager review, publish) which creates even more transitions. By filtering on the transition the user has access to, we are able to show shorter list of content for the user, removing any confusion for the editors.

I have added documentation in the patch, but there is one thing I want to point out: sometimes content does not change state although it was edited. This was not clear to me at first but if after reviewing the workbench_moderation_node_history table I found instances where editors edited the content but did not change the state since they were not ready to move the content on. This situation is accounted for too.

Status: Needs review » Needs work

The last submitted patch, user-can-moderate-filter---issue-1870366---comment-5.patch, failed testing.

elvis2’s picture

Status: Needs work » Needs review
StatusFileSize
new2.38 KB

Same patch just against 7.x-1.x-dev

elvis2’s picture

Here is a new patch. The following was added:
- the filter now extends the views_handler_filter_boolean_operator
- better ui description for the filter
- a yes-no option, for clarity
- better where clause

I also added the moderation transition "draft to draft". Take a peek at the code to see if you agree.

As stated in #5, the filter description maybe should be re-described to be a filter for moderation transitions. I added a tiny bit of that language. Does anyone have any input on this topic?