I noticed the behavior that if I simply go in and change the URL alias for a page and hit submit, I still get a new revision in the moderation queue. The alias takes effect immediately, so moderation that revision is somewhat pointless. I actually don't know if this is behavior associated with the module or with the revisioning system in 5.x. I'd just like to hear a discussion on (1) where the "problem" really is, (2) if this has been address in 6.x, or (3) any logic that went into making it this way.
Comments
Comment #1
toemaz commentedThe behaviour you describe is correct by design of this module. But as you describe the case, it is indeed a little odd a new revision is made. So, I guess the start of a solution might be to look into developing a mini module which implements the hook_submit for the node which is under revision_moderation.
In the submit stage, you may check what piece of the node really changed and act accordingly. In your specific case, compare the submitted title and body against the current revision. If there is no difference, I guess you can unset $node->revision or give it a false/0 value. The result will be that during the node_save execution, the current revision will be overwritten, instead of creating a new one.
So I guess this solves your problem by adding some new logic. I would not write this into the current revision_moderation module as this logic might be different for each specific case. Good luck and give some feedback if you have some results.
Comment #2
webchickI think I would call this a core bug. revision_moderation just deals with the revision stuff provided by node.module.
To anyone who tries to fix this, however, bear in mind that more about a node can change than just its title/body. For example, files might've been added or removed, or terms changed, or...
Comment #3
chrisfromredfinOK I'm going to put this on my todo list. Thanks for your detailed suggestions.
Comment #4
alexjarvis commentedsubscribing
Comment #5
drupalnuts commentedWe built something to detect changes, in a nodeapi call, we did a node_load on the nid (in the presave state) and serialized the results. We then took the node object from nodeapi, and serialized it, if they were the same, we made no change, if they were not, we added an entry to our audit table, might help here.
Comment #6
seandunaway commentedbump and subscribe :)
Comment #7
droplet commentedmaybe field module issue now ?
Comment #8
seandunaway commentedJust in case anyone else is having this issue, a workable solution:
I tried #5 but went crazy having to filter the node objects because a lot of the data is different between the referenced node in presave and the result of node_load.
One solution I found was to node_view both (don't forget to clone the referenced node, else your referenced node will get modified something nasty) into rendered output and then compare. This had the benefit or flaw of comparing only fields which were set to display. However, I ended up tossing it because my page/teaser views didn't have taxonomy terms, and also had voting results, etc. This could be a workable solution.
However, I finally caved and just utilized the diff module which I had already installed. Here it is for anyone else who rather let diff module do the heavy lifting. It's still kind of hacky, but I hope diff will someday abstract out a comparison function that takes two node objects and can return something more sensible that doesn't need to be theme'd. (There's an issue for that.) A patch to core to prevent revisions if unchanged would be ideal.
Comment #9
chrisfromredfinComment #10
mitchell commentedIs this still valid after #1723892: Support for revisions for entity save and delete operations?
Comment #16
hchonovI don't know how this worked in D7, but in D8 HEAD a new revision will be created only if the checkbox
Create new revisionis checked. If you submit the form and that checkbox is checked, then I think it is the proper behavior to create a new revision. This might be used as e.g. solving some kind of caching problems.If you are not happy with this behavior you can always change it in a
hook_form_alteror in an entity builder.