Question by RTH, moved from other thread to its own topic - RdB

How does the moderator proceed after he has reviewed the revision, decides not to publish it as it stands, and tells the author to revise it? How does he remove it from Pending until it has been edited again?

It seems that 'current' status is used to flag which revision has been checked by moderator (a newer one flags pending again) but with unpublished work, there doesn't seem to be a way for moderator to shift the current flag onto the one he has rejected. Publishing does it, but he doesn't want to do that. Also, by using current status in this way, when only a single revision (the original) exists, it must be current, so it is taken as pending. Even with a way to shift the 'current' flag, a moderator can never get that article out of the Pending tray until a second revision is made. This is likely the most common case.

Comments

rdeboer’s picture

Q: "How does the moderator proceed after he has reviewed the revision, decides not to publish it as it stands, and tells the author to revise it? How does he remove it from Pending until it has been edited again?"

A: He doesn't.
Good penetrative thinking RTH! Until you install Workflow you won't be able to differentiate between "in draft" (i.e. with the author) and "in review" (with the moderator), let alone transition to and from these states.
Basically without Workflow "in draft" equal "pending moderation/in review", and both author and moderator can simultaneously touch it. Without Workflow we don't have distinct states, so we cannot assign distinct access permissions for author and moderator either. Some users (e.g. midkemia) have indicated that this is exactly the way they like it, as there's not the overhead/formality/complexity of to-ing and fro-ing between author and moderator (author submits, moderator rejects, author resubmits, moderator rejects again, author resubmits one more time, moderator publishes)... for every little change. But if you'd like to explore a stricter model that may be more like what you seem to be after, have a look at the 3 tutorials on the Revisioning project page.

Aside:
I feel we can blame the lack of core support for the grey area between "draft" and "in moderation". Have you noticed the node table has a moderate flag that is now obsolete? While core cleanly implements the concept of revisions (using the node_revisions table), it has few 'hooks' to support the concepts of "drafts" and "pending revisions". That's why we have to fake it, with this wishy-washy rule: "pending revision = revision.vid > node.vid". We should really have a status code on each revision in the node_revision table, which would unequivocally tell us whether the revision is "in draft", "in moderation" or "published". Something for the next version of Revisioning, perhaps, a simplified version of what one can do with Workflow in a more heavy-weight fashion?

rhouse’s picture

Hi Rik,

Okay, let's assume we are only doing an approximate simulation of the full cycle, and that we don't want Workflow. Do I have this correct:

  • For published content, 'current' indicates the published version; existence of a later version than current is taken as Pending.
  • For unpublished content, only one (the 'current') version, OR more than one version and latest greater than 'current', is taken as Pending.

If I have that right, it leads to the situation I explained in #470682: Revision message repeated, where, for unpublished nodes, a naive author will see a node marked as current, but it is not their latest version - confusion clearly possible.

How about this simpler rule:

  • For ALL content, if the latest node is not the published version, consider the item Pending.

For unpublished content, the latest version will by definition not be the published version (because there isn't one), so all unpublished work appears in Pending (this is the case anyway with the present rule, because we force the (meaningless) 'current' version to always be the first one), and it is safe to allow 'current' to be the latest revision. For published content, it will only be Pending if a later version than the 'current (published) one has been created.

Another way of looking at this proposed rule is: For unpublished content, consider a non-existent 'version zero' to be the 'published' version; then in all cases, the existence of a later version than the published version means it is Pending. Different code will be needed upon version creation, because published nodes should revert the current version whereas unpublished nodes should not, but the concept is clean and therefore likely to lead to fewer hidden gotchas.

Actually, I for one would find that quite adequate for the limited numbers of authors and articles I will have to deal with, so count me in with midkemia. So a question for all interested parties: Does the rule I propose raise any hidden problems that you face?

Ron.

rdeboer’s picture

Hi Ron,

Thanks for collectively trying to get our brains around this!

First, a quick note... the word "current" from a user point of view is indeed confusing, in the case where a node is NOT published. It doesn't really mean much, since when a node isn't published, the public cannot see ANY revision.

"current" is merely a (bad) reflection of the way the database is organised in core and that is that for data integrity reasons every node (published or not) must point to a revision (aka $node->vid) and for lack of a better word we call the revision "current", even when the node/revision is not published. I have tried setting a node's vid to zero/NULL/0 and **bad** things happened.
Maybe in the case of a node that is not published we should change the label "current" to
o "current candidate for publication" (when there is only a single revision, not published)
o "previously published revision" (when the latest revision is the one $node->vid points to, not published)
o "archived" (when a more recent revision exists, not published, i.e. the same label we give to revisions older than 'current')

* For published content, 'current' indicates the published version; existence of a later version than current is taken as Pending.
* For unpublished content, only one (the 'current') version, OR more than one version and latest greater than 'current', is taken as Pending.

TRUE

How about this simpler rule:
* For ALL content, if the latest node is not the published version, consider the item Pending.

First, in the light of the above, I guess we should read this as:
For ALL content, if the latest revision is not the one $node->vid points to, consider that latest revision Pending.

I don' t quite follow the second part of your comment.
Are you saying that the simpler rule results in different behaviour or that the simpler rule simply rephrases the double rule in a single sentence?

rhouse’s picture

Hi again Rik, Thanks for confirming my understanding of the rule as being used.

I think you misunderstood my suggestion. I was not saying to ever make vid zero, I said that one could consider that all nodes have a published version by imagining that unpublished nodes have a fictional published "node zero" prior to the first version that actually exists. That doesn't imply actually trying to invent such a node or make anything refer to it. But the fiction allows one to adopt the simpler rule I propose. It is not the same as the existing rule because in the case of unpublished nodes, it allows the 'current' pointer to refer to the latest node, which in turn prevents the bad user interface problems that will confront the most naive users, namely untrusted guests. The following things are important:

  • The change affects unpublished nodes only; the rule for published nodes remains the same.
  • The rule is simple, but the coding for unpublished vs published nodes is different, because there is not actually a 'published node zero' for an unpublished node; it is purely imaginary and the code needs to code around that fact.
  • Both the current rule and the proposed rule make all nodes Pending if the latest version of the node is unpublished.
  • The practical effect for unpublished nodes is the same (all are Pending), but the mechanism for this effect is different and better. The existing mechanism has a special rule for nodes consisting only of the original version, then they force edits to revert 'current' to that original version and have a different logic for nodes with two or more versions. The proposal treats them all the same: whether there is one or many edits, if the node is not published, then it is Pending. This allows us to NOT force 'current' back onto the first version; it can remain on the latest edit, which in turn means that a naive user editing a node will, upon saving, see their freshly edited node in front of them, and in the list their latest change will show as current, unpublished. The current behaviour of showing their original node will obviously lead to confusion and error, especially when an edit involves something small in a large article; edits will get lost for certain.
  • In fact, for unpublished nodes, there is no reason to stick with the word 'current' for the current node; it can be displayed as 'latest', which is more meaningful to the user.

Thus for your specific question:

First, in the light of the above, I guess we should read this as:
For ALL content, if the latest revision is not the one $node->vid points to, consider that latest revision Pending.

No, because the fictional node zero is fictional, and so that fact must be coded around; the rule is simple, the code might not be (but should have a benefit anyway because simple concepts have a way of paying off).

Here is another way to look at it that does not involve the fictional node zero:

  • Published nodes are Pending if there is a later unpublished version than the 'current' published node. (Same as the existing rule)
  • Nodes with no published version are always considered Pending; one now can and will allow the 'current' node to always be the latest version, as it will not be checked to determine Pending status; a clearer user interface then follows.

In order to try to think through how this might be coded, I discovered I need to understand something that I can't find in the drupal docs: When status is 1, does that mean that this node (but not necessarily this version) is a published node (meaning that it has somewhere a published version), or does it mean that specifically this version of this node is published (and therefore, if it is zero, tells us nothing about whether a different version somewhere might be published)?

Ron.

rdeboer’s picture

Hi Ron,

To start with your last question... A node itself doesn't have versions. It just has some basic info, but no content. For its content a node has a pointer into a table (i.e. collection) of node_revisions. In programming terms, the revision pointed to from the node (the vid) is referred to as the 'current' revision, even if that doesn't make sense to end-users when the node isn't published (node->status=0), which means that none of the revisions are shown. To 'publish a node' means 'to make the current revision publicly visible'. There are no versions somewhere else.

Both the current rule and the proposed rule make all nodes Pending if the latest version of the node is unpublished.

Not quite right -- if the node is unpublished, then
a) if the node vid points to the latest revision, the node is considered unpublished or previously published
b) if the node vid points to a revision that is not the latest, then the node (i.e. the latest revision) is considered pending

Examples of a) and b):
a) previously published, not pending: nodes that show this pattern show up under the "Not published" tab
"Some title", rev #201 <--- node.vid ('current, unpublished', but should perhaps be labeled 'latest, unpublished' or 'previously published')
"Some title", rev #200 <--- archived

b) pending, nodes that show this pattern show up under the "Pending" and "Not published" tabs
"Some title", rev #201 <--- pending moderation
"Some title", rev #200 <--- node.vid ('current, unpublished', but should perhaps be labeled 'archived')

The current behaviour of showing their original node will obviously lead to confusion and error...
I agree.

I am very much leaning towards the addition of a column on the node_revisions table, i.e. adding a status-code on each revision which would unequivocally tell us in what state the revision is in, e.g.:
0 = "in draft": author is still working on it, not ready to give to moderator for review, yet
1 = "pending moderation": author has indicated their draft is ready for review
2 = "current, published"
3 = "unpublished/archived": i.e. was published before, but taken from public view

That way we can have the node point to the latest revision (or any revision in fact) without getting into discussions like we're having now. It would be clear-cut.

The author would have 2 buttons on his edit screen:
"Save as draft" (not ready for moderation yet)
"Save and submit for moderation" (setting revision status code to 1)
Hence, it would be clear to both author and moderator in whose "court the ball" is.

rhouse’s picture

Hi Rik,

Yes, the "previously published" situation is one I wasn't considering. That would be the only way to shift the vid on an unpublished node (by publishing and then unpublishing). I agree with your idea that an extra column in node-revisions would be a good solution. Isn't that a table provided by drupal core? Is it allowable to add a module-specific column to it?

Ron.

rdeboer’s picture

Hi Ron,
Yes node_revisions is a drupal core table.
I believe it is allowable to add a column (haven't done it before though).
Alternatively Revisioning could create its own small table and connect it to node_revisions via an SQL join.
Rik

Anonymous’s picture

I would tend to go for a table of ours, not theirs :)

That way we have better control, if they change things, it also makes for a cleaner uninstall.

We also have options to add more columns as identified

Though already having 170+ tables do I really want another, yea why not :)

rhouse’s picture

Hi Rik, John,

In my capacity as ordinary naive user, I would feel happier with a custom table, as I would know that there is no hocus pocus going on that I can't master - delete the module, delete the table, and it's gone. I don't think number of tables is of any concern, and because this module concerns preparation and publication, rather than display, efficiency is no concern either, as the bulk operation is site viewing, which doesn't concern it.

Cheers, Ron.

rdeboer’s picture

I'll look into this, as either the extra column or extra table approach would also allow us to solve #472710: What is the difference between a "draft" and a "pending revision"?.
But before releasing any more development snapshots, I'd like to feel confident that the pending revisions alert block is the way we want it to be, the column sorting on the Accessible content page works and that #466930: New tabs for 'My content' menu: Pending,Editable,Published,Not published appears bug free, so that we can make an official release.
What do we think -- is the development snapshot stable enough?

rhouse’s picture

Assigned: Unassigned » rdeboer
Category: support » feature

Hi Rik,

It seems to be correct, but of course the issue of showing confusing unpublished content display to the naive user remains. It seems that until the wider changes go in, we have to choose between these situations:

  1. Naive guest authors see old unpublished content marked as 'current' - with likely mistakes in editing the wrong version (this is what HEAD does, I think)
  2. If the change I proposed earlier in #470682: Revision message repeated comment #21 is made, the confusing display is fixed, but the moderator will now see content that was published and has been removed from publication as Pending again, thus wasting his time.

As a stop-gap measure, I vote for (2), because I would rather the experienced user be slowed down than the naive user make errors - the latter will end up wasting the moderator's time anyway trying to sort out problems.

Since John has a big site already, perhaps his vote is more important than mine on this question.

Ron.

rdeboer’s picture

Ron,
I would say that on most sites, most nodes are either published or in their initial (unpublished) draft stage. Those would be the most common scenarios: creating new content, or modifying content that is currently live.
Editing content that has previously been taken off the site is less common, so while your gripe is justified, its occurrence isn't widespread -- or am I wrong?
Anyway, I'll fiddle with the wording a bit more.
In addition, when the Save button is pressed, I may get the code to redirect to either the revision summary table or to view the page just saved (rather than the current revision).
Watch this space.
Rik

rhouse’s picture

Oops, found some bugs...

  • If Guest writes a story, then edits it, making a second unpublished revision, and then if moderator edits that second revision and ticks the published box, it is the first revision that gets published.
  • The In Draft tag leads to a completely blank page.
  • Nothing ever shows up under Pending in the moderator's role.

Sorry! Ron.

rdeboer’s picture

Don't be sorry Ron -- that's what we need.
Better find them now than later.

point 1) I can reproduce this; it's strange but kind of expected
First of all, it seems to me that you have 'administer nodes' on for the moderator role -- this gives them God-like powers and is not necessary and is the reason why you ran into this, which is that you've ended up with two publication systems working at the same time (but not necessarily in harmony).
This is what happens? The 'Publish' tickbox belongs to the old (core) system of publishing a 'node', rather than the revisioning sense of publishing a revision. So when you published the node it makes whatever the node points to (vid, formerly known as 'current') the live version. You have also created a new revision (by pressing Save), but you haven't published that one yet. Hence the confusing behaviour.
It needs some more work (maybe the Published box should disappear from the form when Revisioning is installled), but there's no error in the logic, I don't think

point 2) and 3) I cannot reproduce -- did you update Module Grants as well as Revisioning?

Thanks for the testing!
Rik

rhouse’s picture

"-- did you update Module Grants as well as Revisioning?"

Oops, no. I'll try that. Thanks,

Ron.

Addendum: Updated module_grants: the blank page still persists, the Pending tab behaviour is now strange:

Guest sees correct details under I created-Pending, but sees nothing under I can access-Pending.

Moderator sees all Pending content, including Guest's, under both I created and I can access.

PS: Moderator has admin nodes because moderator is me. (This will probably be common.)

Anonymous’s picture

Hi Rik

re #10

The only feature I personally need on the Block is to elimiate those that "dont need moderation". After your previous suggestion of crteating new revisions I was still left with unpublished nodes in the block for those that Do not require moderation and do not create revisions.

The code may also need to be re-addressed when we have better control, to accomodate "Revisions Deletion" module deleting all previous revisions

The way i see the future, is that for each node we need a revision number which identifies the latest version that is approved for viewing whether it be published or not ( I think this was mentioned elsewhere)

rhouse’s picture

Hi Rik,

I have fixed my bugs 2 and 3 from #13: It was necessary to clear the cache. I should have done that, but perhaps we need to highlight it somehow, as these modules seem to need it - same also for the need to keep in step with module_grants.

I am now seeing a different display, very much improved! Many thanks for all your efforts on this.

Ron.

rdeboer’s picture

@Ron, #15,
The behaviour you get is so weird that I can't imagine midkemia and I not having experienced at least a hint of what you're seeing.
How did you do the upgrade? Did you just download the latest copies over the top of the existing? This is fine, but you MUST also visit the Site building>>Modules page as this refreshes the menu structure and other bits and pieces.

@John, #16 Re: pending revisions block:
That one we cannot do much about at the moment, as we can't tell the difference between a node with a single revision that was unpublished (of a type that requires moderation) and a node with a single revision that is not published yet (i.e. is pending).
We need the much discussed future revision status code for that.

rhouse’s picture

Hi Rik,

Yes, the weird bugs have gone as from when I cleared the cache, but I had not visited the Site building>>Modules page. AFAIK, the only remaining bug is the first one from #13, but now I'll redo the test to confirm. The new tab structure is really good, IMHO.

Ron.

(Update) Confirmed, the following is the only bug I can find that remains:

  • If Guest writes a story, then edits it, making a second unpublished revision, and then if moderator edits that second revision and ticks the published box, it is the first revision that gets published.
rdeboer’s picture

Hi Ron,
More improvements will be going in tonight. But the first point of #13 isn't one of them -- I'm not sure whether it can be fixed easily.
If you want the behaviour you're after, as an admin (i.e. publish the latest revision), you have to Untick "New revision in draft/moderation" on the form you're editing.
Rik

rhouse’s picture

Thanks Rik, that's fine. Maybe I need to snoop in the code again. :-)

Ron.

rhouse’s picture

Hi again Rik,

I just downloaded your latest changes from HEAD, and I notice that the issue from #13, #19, and #20 has been fixed. I noticed you changed the title from "current, unpublished" to "archived", which is a very nice improvement, thank you! But I am danged if I can figure out how you fixed the bug! Code looks the same to me. It must be a smart change somewhere I am NOT looking.

Many thanks!
Ron.

rdeboer’s picture

Status: Active » Closed (fixed)