Description:
When you edit a content type and check 'create new revision', that setting doesn't seem to be remembered when you go and create/edit a node of that type. It always appears to be unchecked. I would expect it to be set to whatever it is in the 'edit content type' form.
Platform:
Drupal 7.0-alpha1, Apache 2.2.11 (Win32), PHP 5.2.10, MySQL 5.1.35
Steps to reproduce:
- Basic install of Drupal 7 head (use all defaults)
- Edit content type: Article
- Check 'create new revision' (under 'publishing options') and save
- Add new Article node
Result:
In the node edit form, 'create new revision' is not checked.
Expected behaviour:
The 'create new revision' setting for the content type should be retained as the default on the node edit form.
After saving the node, if I edit it again, the 'create new revision' checkbox is still unchecked.
I also then installed the 'blog' module and tested with that content type -- with the same result.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | drupal.ajax-ids.25.patch | 1.26 KB | sun |
| #17 | drupal.node-revision-states-wtf.17.patch | 1.31 KB | sun |
| #13 | issue-685784-2-better-script-4.patch | 1.66 KB | alexjarvis |
| #11 | issue-685784-2-better-script-3.patch | 1.63 KB | alexjarvis |
| #8 | issue-685784-2-better-script-2.patch | 1.67 KB | alexjarvis |
Comments
Comment #1
alexjarvis commentedBehavior is general, not specific to alpha1.
I'll take a look at this.
Comment #2
alexjarvis commentedThis is actually only an issue for users with the 'administer content' permission. The problem stems from the use of #states to automatically check the 'Create new revision' box when a revision log message is entered. Unfortunately #states also merrily unchecks the checkbox when the log is empty, which always is initially.
I propose two alternative solutions to this:
1) Simply remove the #states entirely from the process. This restores D6's behavior and auto revisioning node types will have 'Create new revision' checked as expected. Patch.
2) Replace #states with a more sophisticated script that never unchecks the 'Create new revision' checkbox, but does automatically check it if the log is filled in. Patch.
Personally I prefer option #2 as it is the most in keeping with the intent of using #states and has the most natural behavior.
Comment #3
alexjarvis commentedHad a discussion this weekend that convinced me this issue is a performance regression and should therefore be reprioritized critical.
Comment #4
kpander commentedApologies for taking so long to respond... I'll try and find time this weekend to test the patch (thanks!).
Comment #5
alexjarvis commentedHappy to help:)
You might also want to look at #728090: "Revision information" can have incorrect summary; it's a similar issue, but it's new to D7 rather than a regression.
Comment #6
arhak commentedI ran into this
this is what I was about to open in an issue:
if a site-builder sets up a content type with "Create new revision" he/she is expecting that a new revision will be created by default regardless of editors having administer nodes permission
but if the editor have such permission and doesn't navigates to the revision log, then the checkbox will be unchecked (if JS is enabled on his/her browser)
which is an inconsistent and undesirable behavior
Comment #7
catchPlease add a leading space for the comment.
I'm not qualified to review js but option #2 seems preferable.
Comment #8
alexjarvis commentedOption #2 with a leading space in front of the comment, per catch's request.
Comment #9
kpander commented#8 Seems to work, at least from my perspective. Great! (Tested against 7.0 alpha 3)
Comment #11
alexjarvis commentedLast patch got some Windows line ending somehow, rerolled.
@kpander - Should this be marked reviewed?
Comment #12
aspilicious commentedWrap comment, it exceeds 80 characters
Comment #13
alexjarvis commentedWrapped comment.
Comment #14
kpander commented@alexj: Looks good!
Comment #15
sunA couple of white-space issues in this patch. But anyway...
I guess we should take a step back. Is this behavior correct after all?
The checkbox only appears for administrators. The current code tries to auto-enable the checkbox if the log message is non-empty. That's a nice little tweak, but we do not have such magic anywhere else in Drupal (yet). I didn't even know that this code here exists.
Therefore, to fix this bug, we only set #states if $node->revision is not enabled. In turn, this means that when $node->revision is enabled (by default or not), there is no magical auto-enabling at all.
However, I'm not sure whether I like/support this behavior in the first place. So dropping that #states property entirely is a valid option 2).
Comment #16
alexjarvis commentedAgreed, removing #states entirely is a perfectly valid fix to this issue. Ultimately it's just a question of what the default behavior should be.
If we just drop #states, my previous patch should be usable. If we want auto-checking/unchecking then I'm happy to clean up any remaining white-space issues and roll another patch. I just need to know which approach we want to take.
Setting back to "needs review" to stimulate discussion.
Comment #17
sunThere you go.
Comment #18
sunsorry, I forgot about progressive enhancement modularity form alteration clusterfuck.
So this one it is.
Comment #19
alexjarvis commentedLooks good.
Comment #20
dries commentedCommitted to CVS HEAD. Thanks.