Titles of book pages can be lost while modifing a book structure

VladSavitsky - June 20, 2008 - 13:32
Project:Drupal
Version:6.x-dev
Component:book.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Let me describe a problem:
I have opened a 2 sites pages:
1st: admin/content/book/234 (this is a structure of new book)
2nd: node/137/outline (This is a top level book page)

Then in 2nd window I set new parent of this book page to page with id=234 (the same as I see in 1st window).
I have saved a changes in 2nd window and switched to window 1.
There is no changes visible in window 1 because I didn't refresh a page (Just forgot) so I didn't saw a new subpages...
I have changed a title of one of the pages and saved changes.

Page was reloaded and I have seen a book pages without titles!
(To fix this: switch to previous version of page)

Who I think It should work:
I pages was not listed at the book's structure page (admin/content/book/234) book.module shouldn't change a title.
OR
Just write a warning like "structure was modified by other user... You should reload page"

I'm using this module a lot and want to say "Thanks for a great module".

#1

pwolanin - June 30, 2008 - 16:34
Version:6.2» 7.x-dev

Right - it sounds like this is a bug in the form submit handler on the admin screen. It should be fixed in 7.x first. I'm not sure how we should handle the lockout. Maybe the hash of the menu tree?

#2

pwolanin - June 30, 2008 - 17:33
Status:active» patch (code needs review)

Here's a starting patch - saves the hash of the tree structure as a hidden value and compares it to the current value. Please test, and comment on the error message.

note- I found a serious bug in book at the same time: http://drupal.org/node/276846

AttachmentSize
lock-form-272900-2.patch2.11 KB

#3

pwolanin - July 2, 2008 - 18:08

for comparison the error message node module throws is:

form_set_error('changed', t('This content has been modified by another user, changes cannot be saved.'));

#4

dmitrig01 - July 4, 2008 - 18:37

I think we should keep this consistent with node.module, so once the message is changed I'll RTBC - I testred and it works as advertised.

#5

dmitrig01 - July 4, 2008 - 18:37
Status:patch (code needs review)» patch (code needs work)

#6

pwolanin - July 4, 2008 - 19:48
Status:patch (code needs work)» patch (code needs review)

Ok, revised the error text and added another code comment.

AttachmentSize
lock-form-272900-6.patch2.25 KB

#7

dmitrig01 - July 5, 2008 - 00:41
Status:patch (code needs review)» patch (reviewed & tested by the community)

Tested, works well, and patch makes sense.

#8

Dries - July 5, 2008 - 06:01
Status:patch (reviewed & tested by the community)» fixed

Committed to CVS HEAD. Thanks.

#9

pwolanin - July 5, 2008 - 13:57
Version:7.x-dev» 6.x-dev
Status:fixed» patch (reviewed & tested by the community)

same bug is in 6.x

#10

pwolanin - July 5, 2008 - 16:17

oops - patch above fails on 6.x (last hunk doesn't apply) - not sure why. Here's a re-roll that applies cleanly to 6.x. Re-tested too.

AttachmentSize
lock-form-272900-6x-10.patch2.25 KB

#11

Gábor Hojtsy - July 8, 2008 - 10:20
Status:patch (reviewed & tested by the community)» fixed

Thanks, committed to 6.x.

#12

Anonymous (not verified) - July 23, 2008 - 10:56
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.