Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
book.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 May 2015 at 20:54 UTC
Updated:
22 Jan 2016 at 10:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jhedstromNot a complete fix yet, but here's a test that illustrates the issue, and the beginnings of a fix.
Comment #4
jhedstromThis gets things back to working as expected.
Comment #5
jhedstromComment #7
jhedstromAdding a beta phase evaluation.
Comment #8
jhedstromComment #9
pwolanin commentedminor, please use route names instead of paths when adding test code:
I think you might be able also to use the base for ID like: book_form_node_form_alter ?
So at least you won't run this code in every form
Comment #10
jhedstromI didn't know about the ability to pass a route to
drupalGet(), that makes much more sense. Also changing to the base form works, and greatly simplifies the function.Comment #11
pwolanin commentedThese 2 lines should also use the routes via a Url object
like:
Comment #12
jhedstromHere's a patch that fixes the overlooked drupalGet calls mentioned in #11.
Comment #15
pwolanin commentedChanges look good, assuming the tests are still green.
Comment #16
alexpottThis loss of specificity in the form alter is worrying. I think we need to include the operation in the base form id.
Comment #17
pwolanin commented@alexpottt - hmm, good point. But I don't think there is an option to include the operation? The form ID includes the bundle name which is too specific.
I had assumed that was delete specific, but I see it's more generic:
I'm not seeing an obvious way to get the operation other than looking at the form ID?
Comment #18
alexpottLet's add the p tags with
#prefixand#suffix.Comment #19
pwolanin commentedPer discussion with alexpott, fixing the base for ID to include the operation.
Comment #22
pwolanin commentedtest failed on settings.php, so I think it was a bot issue
Comment #24
jhedstromI think the patch in #19 has addressed Alex's feedback.
This seems like a beneficial change. Does it need a CR?
Comment #27
lokapujyaSimple reroll.
Comment #28
lokapujyaJust want to see the test-only again.
Comment #30
jhedstromI think this is good now. If we need a CR, I can add one as mentioned in #24.
Comment #38
lokapujyaSo if the book is deleted the direct child pages become a book (rather than parent of "none") which is the same as D7.
Note that node/{nid}/outline/remove is still not allowed (Access Denied) and has a test.
I don't see any reason for a CR.
RTBC from my testing.
Comment #40
Trupti Bhosale commentedVerified the patch "2482857-27.patch" mentioned in #27, the child nodes are now accessible after applying the patch
Steps performed to verify the patch:
1.Created a Book page "Test Page"
2.Created child nodes "Test page 1" and Test page 2".
3.Deleted the "Test Page" , while deleting got an error "The website encountered an unexpected error. Please try again later." on a second attempt it got deleted
4.Accessed "Test page 1" and "Test page 2" and got error "( ! ) Fatal error: Call to a member function access() on a non-object in C:\wamp\www\drupal\core\modules\book\book.module on line 233"
5.Applied the patch and repeated steps 1 to 4 with book names as "New Page" and child nodes as "Child page 1" and "Child page 2"
6."New Page" got deleted without any exception error and I am able to access "Child page 1" and "Child page2" without any fatal error.
7.However still the fatal error is displayed for "Test page 1" and "Test page 2" (the child pages created before applying the patch)
So if the point no 7 is meant to be like that then the issue can be marked as RTBC from the testing.
Comment #41
jhedstromComment #42
pwolanin commenteddoesn't apply
Comment #43
lindzeng commentedPatch was applied with fuzz.
Comment #44
lindzeng commentedComment #45
jhedstromBack to RTBC.
Comment #46
alexpottThis is an API change. I don't think we can do the fix this way now. I think we'll need to just change the book_form_node_delete_confirm_alter() to book_form_node_confirm_alter() and test the operation.
Instead use book_type_is_allowed()
Why is this change necessary to fix the bug?
Is this change of the child bid explicitly tested?
Not in scope.
Comment #47
jhedstromThis patch addresses #46:
Comment #48
alexpottRe #47.3 I don't think we should be making UI changes in a bugfix issue. It was this way in Drupal 7 when book deletion worked. I'm not going to push on #47.5 other than to say that on bigger issues it is these type of out of scope changes that makes large patches hard to review because you have to go back and think so why is that change relevant to the scope of this issue.
Is this used?
Comment #50
jhedstromThis removes the warning class from the message.
I'd happily do DX docs follow-ups, but test-only patches are very hard to get reviewed (historically anyway).
Comment #51
swati_qa commentedVerified the patch "2482857-50.patch" mentioned in #50.
Steps performed to verify the patch:
1. Created a Book page "Parent Node"
2. Created child nodes "Child Node 1" and "Child Node 2".
3. Deleted the "Parent Node" , while deleting got an error "The website encountered an unexpected error. Please try again later." on a second attempt it got deleted
4. Accessed "Child Node 1" and "Child Node 2" and didn't get any error.
5. Applied the patch and repeated steps 1 to 4 with book names as "Patch_retest_Parent Node" and child nodes as "Patch retest_Child Node" and "Patch retest_Child Node 2"
6. "Patch_retest_Parent Node" got deleted without any exception error and I am able to access "Patch retest_Child Node" and "Patch retest_Child Node 2" without any fatal error.
7. No error is displayed for "Child Node 1" (the child page created before applying the patch).
So, issue can be marked as "PASSED" for errors and warnings.
Comment #52
swati_qa commentedComment #53
alexpottCommitted a224bb8 and pushed to 8.0.x and 8.1.x. Thanks!