Hello everyone,
First let me explain steps to reproduce:
- Created some node with User A
- Added a revision with User B
- Deleted User A migrating all its content to anonymous
- Revisions of User B disappeared or were assigned to anonymous too.
My thoughts on why:
First of all we have two major tables saving revisions data, the node_field_revision and the node_revision. For some reason I don't know why the node_field_revision saves for every revision added the uid, and this value will always be the author of the content (In this case user A), in other hand the node_revision table saves the revision_uid and this is the correct value (the user who created the new revision).
When I delete a user "node_user_cancel" function is triggered and this line "$vids = \Drupal::entityManager()->getStorage('node')->userRevisionIds($account);" will retrieve the revisions from node_field_revision table, here I think we've the first problem because we're assigning the anonymous to uid and revision_uid on both tables (here the revision of user B is also assigned to anonymous), and for some reason the batch runned successfully and finished, however some revisions remained on node_field_revision with the old uid (second problem, no issues occured during batch neither logs). the third problem and more serious one, in the function "node_user_predelete", after the batch runs is looking again to table node_field_revision and because all revisions in this table are assigned to user A (and for some reason were keep with his uid (not anonymous)) are deleted, without any check on the option I selected which was "user_cancel_reassign", not "user_cancel_delete". This is a very dangerous behaviour and I think it should be re-designed or re-thinked.
Any thoughts on this, anything I'm missing?
Comments
Comment #2
joaogomes_cd commentedComment #3
joaogomes_cd commentedComment #4
cilefen commentedFor a bug, the issue title could be more descriptive, which is perhaps why no one has commented.
Comment #5
joaogomes_cd commentedComment #10
larowlan#2977362: Revision user incorrectly appears as anonymous user when node author is canceled