First of all, thx for this nice module. It is just what I was looking for. I tried it out and everything seems to be working fine. Nice work!
Just one remark: somehow I was expecting that an approved revision would become the current revision instead of copying it to a new revision. It doesn't make much sence if you end up with a list of archived revisions with each time 2 identical revisions who are following eachother. Just the log is different: Copy of the revision from [the previous one].
Anyway, in case there is a queue of several moderated revisions, this copy feature might make sence.
Beside this remark, I encoutered one little problem: when a revision is being copied and saved, the 'insert revision' action from the nodeapi is not being called. And so, one of my own modules was not triggered.
Now, I would like to propose a solution which can solve both above issues: add an extra function in this module which simply makes the approved moderated version the currect one. The only thing which needs to be updated is the 'vid' next to the 'nid' in the node table (I don't know for sure whether that's the only thing, but I don't think it can be that hard).
But in order to keep both possibilities open, there might an option in the admin/settings where you can choose to create a new copy or just change the version status.
Is there anyone who feels something for this feature? In order to check it out, I'll try to create a patch so it can be tested.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | revision_moderation_watchdog.patch | 885 bytes | toemaz |
| #26 | revision_moderation_publish.patch | 828 bytes | toemaz |
| #25 | revert-publish.patch | 1.38 KB | webchick |
| #20 | revision-publish.patch | 2.92 KB | webchick |
| #7 | revision_moderation_1.patch | 3.43 KB | toemaz |
Comments
Comment #1
toemaz commentedI have to correct something from the issue description. The little problem I was talking about, is in fact not a problem. It is working well! So thats ok.
Still, I would like to hear some reactions on the idea of just changing the revision status instead of copying the revision.
Comment #2
marcoBauli commentedtoemaz: yes, this would be nice to have, avoiding also to delete the other identical revision. Automagick is good :)
+1 for me. but as a user i can offer my feedback and testing only
Comment #3
toemaz commentedSince I have a positive reaction, here is an attempt.
Apply the patch, go to yoursite.com/admin/settings/revision_moderation in order to set the default behaviour and you are ready to give it a try.
If you choose 'promote' instead of 'copy', it will simply promote the status of the node to the current one and add some log information on when the revision has been promoted. Perhaps we might also add some extra information who promoted it etc...
Comment #4
toemaz commentedIn case you can't apply a patch, find the full module attached (be sure you change the name if it is different than revision_moderation.module)
Comment #5
toemaz commentedThere were some issues with the previous path so here is a new one.
Comment #6
webchickthis is a patch; marking as such. won't have time to test it myself, but if you can get a few more eyes on it and get it marked rtbc I can probably commit it.
Comment #7
toemaz commentedThx webchick. It really needs some more testing. I found another mistake. A new patch is provided.
There is one more thing I don't have a clear solution for. Before describing the issue, I'd like to state some definitions:
Description of current workflow:
When the revision list is being displayed, the actions next to the moderated revisions are: revert and delete. If you would like to promote a revision, you need to view the revision first and then click the publish revision link. Of course, this will only work after applying the patch and set the right behaviour in admin/settings/revision_moderation.
Problem:
There is no way to promote a revision from the revision list. You see only the revert and delete possibility, no promote possibility.
Solution:
We should be able to alter the revision list by
Implementation:
Altering the revision list is not possible with the core function node_revision_overview. But the new diff module, gives us the opportunity to alter the 'diff_node_revisions' form (see diff_diffs_overview function).
Conclusion:
The best solution would be changing the core node_revision_overview function so the core form can be altered by the diff module and the revision_moderation module. The change can be as simple as: replace the code from the core node_revision_overview function with the code from the diff_node_revisions function in diff module.
Is there someone who feels something for doing this? It's clear that the diff module has better code than the code fom the core and it this module can benefit from it!
Comment #8
toemaz commentedI opened an issue http://drupal.org/node/116798 for changing the core code so it can help the revision_moderation module for future enhancements.
Comment #9
toemaz commentedPerhaps there is another solution: override the 'node/$nid/revisions/$vid/revert' path by another module.
Anyhow, I am starting to understand we should not change the current revision_moderation module. It's better for now to add an extra module which extends this one. We'll see in the future whether it can be incorporated.
Comment #10
toemaz commentedThis will probably be the last follow I post. The made a solution for this issue using the new diff module. So, it wont work without this module.
Because the diff module overrides the revisions list and implements a form, I am able to alter it via a new module. Here is the code within that new module:
In the menu hook:
In the form_£alter hook:
In this form alter, all the revisions under moderation (= with a vid > vid of the current reversion) will get a 'publish' action instead of a 'revert' action.
And we end with adding a new function in order to avoid the copy from the revert action.
That's all.
Comment #11
webchickRight; a lot of what you're describing is just the way core handles revisions. Our hands are a bit tied in that regard.
I don't want to get into hacking core, and I'd also rather not create a dependency on diff.module (even though that module does extremely kick ass :D) if we can help it.
So I'm not sure what the best solution is, whether it's a contrib module that 'bridges' the two, or whether it's sticking a bunch of if (module_exists()) into this module or the other (probably this one, as I imagine it's less widely used).
Comment #12
toemaz commentedKnowing that Moshe is maintaining the diff module (together with rötzi), I think he might be able to present the code of the overridden revision path to the core. Of course, this doesn't mean that it will be committed for 4.7.x or even for 5.x. So, I'm a bit pessimistic.
For now, I will handle my workflow with #10 solution. I have to concentrate now on other things. Perhaps marcob can take over some of my tests and find another way.
So, I might come back in a few weeks on this. We'll see. Thx for looking into it and for the feedback.
Comment #13
webchickMarking this back to 'active' since it's not resolved.
Comment #14
jimmygoon commentedI just wanted to shout out my opinion on the thread title... in that I find the "copying" nature to be annoying, I already have too many revisions.
Comment #15
webchickIndeed, but.. that's what core does. :(
Comment #16
jimmygoon commentedWhy can't you just update the published version id to be the one thats in moderation? (do you know of any good documentation on the revision system... I'm slightly confused as to how all the linking goes in the database to make the revision system works)
Comment #17
webchickjimmygoon: Long story. ;) It's not quite that simple...
1. Pressing "revert" (which is the only option you have apart from "delete" on the revisions tab) calls node_revision_revert(), which in turn calls node_save(), which creates a new revision that's a copy of the existing revision. This is simply how core handles revisions and this can't be changed from a contributed module.
2. We can't add more options here (e.g. 'promote') without either a) hacking core (which umm.. no ;)) or b) overriding the revisions tab with a custom callback (which means it conflicts with diff.module, which is also doing that... and it's quite reasonable to assume that people would want to use the two modules together). This is because there is no form on the page for us to "hook" into with an outside module.
3. Now we could _require_ diff.module (which turns this page into a form, which we can then change with this module), but that creates a dependency on another module, which I'm not too hot on.
The only interim idea I can think of is adding a new bullet point to the "Edit / Delete / etc." bullets that appear above moderated revisions that is the "Promote" option that marcob dn toemaz have talked about, which would bypass core's behaviour. This could also appear as a drupal_set_message above the revisions tab. We just can't change the contents of that tab. :(
Comment #18
toemaz commentedJust check the patches or work arounds in the previous follow ups. They will give you indication how the revision system works and how you can get around this issue in several ways.
Comment #19
webchickI have an idea for this actually... just never direct them to the revisions tab whatsoever. ;) Stay tuned.
Comment #20
webchickApplied this patch, which should take care of it:
Comment #21
toemaz commentedYou're making me very curious now ...
Comment #22
toemaz commentedOops, my follow up was posted 'en retard'.
Comment #23
toemaz commentedJust a quick question: what if you are on an older revision (not one under moderation but one older than the current revision) and you would like to publish that one. Once you did, the younger revisions will appear under moderation. That's behaviour you don't want.
So, in case of an older revision (older than the current), you still want the revert action. This is equal to: all the revisions under moderation (= with a vid > vid of the current reversion) will get a 'publish' action instead of a 'revert' action, the rest stays with the 'revert' action.
Does this make sence?
Comment #24
webchickBlah. Crap. you are right.
Comment #25
webchickOk, committed this one.
Now we revert to past revisions, but publish revisions made in the future.
Comment #26
toemaz commentedOne more problem: the node title is not updated!
I also added some watchdog info, so you can track who published a revision under moderation.
Comment #27
webchickThanks, toemaz! Fixed.
Comment #28
toemaz commentedThe previous patch did not follow the correct watchdog syntax. My mistake: I didn't look at the watchdog function in the api.
Fixed now.
Comment #29
BioALIEN commentedWaiting for webchick to commit this patch before its fixed.
Btw, before this issue is closed, can I just say how much I hate the current revision system in core and the way it handles reverts. Since we are dealing with multi revisions, would it not make perfect sense to require the diff.module or even combine the two modules together? Please ponder the thought webchick, I am finding it impossible to live without the two.
Comment #30
toemaz commentedIt's up to us to work towards a nice solution and present it to the core devs. Perhaps we can meet eachother on OSCMS (22-23/03) and work it out (creating patches) together with rötzi and moshe. Nevertheless, I don't have an opinion whether this revision_moderation/diff mofule should be in core or not. It can perfectly live as a contrib module as long as the core leaves some doors open to extend the current functionality.
Other than that, I'm pretty happy with the solutions we came up with so far.
Comment #31
webchickCommitted a variation of toemaz's patch that mirrors the watchdog message that happens when you revert a revision.
@BioALIEN: I agree about the way core handles revisions... this module is basically a 'sandbox' where I'm prototyping the changes I want to make to core in 6.x. Therefore, I'm extremely hesitant to add in dependency on other modules, or extra fancy permission handling, or...
The simpler this module remains, the more likely the core revision system is to get fixed.
Comment #32
pearcec commentedwebchick,
Could we get a new dev release cut for 5? Since you committed this patches?
Comment #33
pearcec commentedLooks like it has been done. Sorry, nevermind. Ah!
Comment #34
marcoBauli commented@people in this issue: i offered for testing, but seems i cannot 'subscribe' to issues (only to forum posts..) so i noticed just now the big progresses...!
sorry about this..and many thanks. By the way, does anybody have a clue of why i cannot subscribe to issues? :o
Comment #35
(not verified) commentedComment #36
BioALIEN commentedI'm using the latest dev copy of this module and can confirm that it's still shifting the approved revision into a new revision and creating a new entry for it in the revision list. Isn't this what this issue is supposed to resolve? ;)
Comment #37
BioALIEN commentedHmm, now that I've got my head around it, I can see how you proposed this functionality (only visible through /node/*/revisions/*/view). Maybe what I was thinking of is asking too much and adding extra complexity.
I'll refrain from posting suggestions on this issue till we can get it into core. Then it's a free for all on the additional improvements and enhancements to make :)
I'll close this issue before I get carried away.
Comment #38
toemaz commentedIndeed. My solution is to use the dif module and then do a form alter to change the revert action into publish action.
Here is my 4.7 solution which I'm going to test now for 5.1