Drupal 7 The patch provided in #96 was committed to core!
Drupal 8 The patch provided in #63 was committed to core!
Upon cancelling your own user account the slightly odd error message appears at the end of the process:
No active batch.
Steps to reproduce:
- Start the process of cancelling your own account.
- Follow the link the in confirmation email.
- After the batch that alters content and deletes your user account you will get redirected to the homepage which then has the error message above on it.
- Also, there is supposed to be a completion message that appears at the end of the process, which doesn't.
This happens because the user's session is destroyed during the last batch operation, but the batch API uses the session ID to lookup the batch. This means that when the batch API operations complete and it looks to run the finished callback, it can't find the batch, because the session has been destroyed. In addition any
drupal_set_message calls are wiped out because the session containing those messages is destroyed.
To solve this, we do two things:
- Immediately after blocking or deleting the user, we log them out by assigning the anonymous user to the global
- In the finished callback for the batch, when we no-longer need the session ID to be persisted we regenerate the users session, as per its suggested usage of being called whenever a user is logged in or out.
We also add some tests to make sure that we're not breaking batch API and that we actually see the messages that are set during account deletion.
User interface changes
Original report by Rob C
Hello all, got a brand new D7 install, i enabled the permission for people to cancel accounts.
When i log in to an account that i am going to delete, click on the confirmation email link, cancel the account (finish the process) i get an 'No active batch.' error.
I guess it has a lot to do with http://drupal.org/node/974
(aka i did search, but could only find this one)
|#96||drupal-1034828-drupal7-only-tests.patch||2.38 KB||Steven Jones|
|FAILED: [[SimpleTest]]: [MySQL] 40,376 pass(es), 7 fail(s), and 0 exception(s).|
|#96||drupal-1034828-drupal7-inc-tests.patch||4.16 KB||Steven Jones|
|PASSED: [[SimpleTest]]: [MySQL] 40,075 pass(es).|
|#93||drupal-1034828-drupal8-only-tests.patch||2.41 KB||Steven Jones|
|FAILED: [[SimpleTest]]: [MySQL] 55,423 pass(es), 5 fail(s), and 0 exception(s).|
|#93||drupal-1034828-drupal8-inc-tests.patch||4.21 KB||Steven Jones|
|PASSED: [[SimpleTest]]: [MySQL] 55,455 pass(es).|
|#90||drupal-1034828-drupal8-inc-tests.patch||6.14 KB||Steven Jones|
|PASSED: [[SimpleTest]]: [MySQL] 54,708 pass(es).|