Repeatable: Always

Steps to repeat:
Install and enable Views, Views UI, Workbench, Workbench moderation.

1. Go to Structure > Content types > Basic page, and in the Publishing options tab, check Create new revision, and Enable moderation of revisions, then select ‘Save content type’
2. Add a new View named ‘Needs review’
3. Set the view to Show ‘Content’ of type ‘Basic page’ sorted by ‘Unsorted’
4. Set the display format to Table
5. Select Continue & edit
6. Set a filter on Content: Updated date, sort descending, granularity: Second
7. Set a filter on Workbench Moderation: State, is one of ‘Needs review’
8. Set a filter on Workbench Moderation: Current (Yes)
9. Remove the ‘Published’ filter
10. Save the view
11. Create a new Basic page titled ‘Test content 1’
12. Enter some text in the Body
13. Set the Section to Test
14. In Publishing options, set the Moderation state to ‘Needs review’
15. Go back to the view – ‘Test content 1’ now appears in the list
16. Set ‘Test content 1’ to Published, and the content disappears from the view list – correct
17. Set ‘Test content 1’ back to ‘Needs review’ and the content doesn't re-appear in the view – this occur after the content has been in the Published state

Expected Results:
User sees the content node in the view when its state is Needs review, before and after it's been in the published state.

Actual Results:
The content can be set to Needs review, and Draft multiple times, and it reappears in the view when it's in the Needs review state. However, once the content has been in the Published state, the content never again appears in the view list when it's in the 'Needs review' state.

CommentFileSizeAuthor
CropperCapture[1].jpg44.93 KBspencer95@gmail.com
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

romaingar’s picture

I've got the same problem... did you find any solutions ?

sreese’s picture

I have also just run into this bug.

The issue seems to be that the "Workbench Moderation: Current" filter stops working. After a node is set to Published state, and then a new draft is created, this filter stops working properly. Removing the filter shows all revisions. Is there another way to only show the current revision of the node in the view?

sreese’s picture

Category: task » bug

Changing to bug report since this does appear to be a bug.

sreese’s picture

I think I have found a solution to this problem so I am posting it here in case it bites anyone else. The key is when you create the view, you need to set it to show content revisions rather than content. They mysql query used when showing content revisions is different than when showing content. One pulls data from the node table, the other pulls from the revisions table. The latter is what you want when dealing with revisions. In my testing so far, the Workbench Moderation: Current filter works fine in a content revision view.

stinis87’s picture

Hi everyone!

I am having the exact same problem, tried to create both a view that shows content and another that shows revisions but none works. Whenever i publish a node, it will never show up in the view set to show content with "moderation-state:cusom" even after i edit the node and switch it from published to the custom state. I also have to use rules to get it to unpublish again, something i think should be a part of workbench.. What settings in views did u use?

mvwensen’s picture

Ok, I had the same issue and i think i have the right way to create a view for it:

I noticed after some query analysing and watching the table changes on a revision saving that the `vid` in the {node} table stays on the latest published revision vid. So if you publish a node and then create a new revision (unpublished) it will not update the `vid` in the {node} table.

I created a "node_revision" view and started to add fields. When I added the "Content Type: Type" field the nodes with the draft created after publishing dissappeared. The field `type` is stored in the {node} table and not in the {node_revision} so it could not be found. I had to make a join on that table with a relationship.

I added the two "Content revision: Content" and "Content revision: User" relations and saw that the 2 "Content revision: Content" relations are two different joins, one on the revision id `vid` and one on the `nid` in the {node} table!
You have to use the "Content revision: Content" `nid` version for the relationship on the field `Type`.

When i did this it worked for me! So you have to look at what fields you need and from what tables they come from en choose the right relationship.

In the end in created two displays, one showing the "latest revisions" and one showing the "published".

I hope my comment helps anybody!