phpbb / customisation-db

A Modification and Style database for phpBB.com and the International Support Teams, codename Titania
https://phpbb.com
57 stars 54 forks source link

Better handling of user deleting #367

Open battye opened 1 year ago

battye commented 1 year ago

When deleting a user it appears that posts and topics are being left behind. Also if a user that has existing approved contributions is deleted we need to evaluate if that's ok. Can the contribution remain without an associated user? If so then maybe nothing needs to be done, otherwise we'll need to change to anonymous and ensure that it can be transferred to someone else. Contributions without approved revisions can just be deleted. 2 relevant core events can be used for this: https://wiki.phpbb.com/Event_List#core.delete_user_after https://wiki.phpbb.com/Event_List#core.delete_user_before

Reporter: DavidIQ Created: 31/Jul/20 1:45 PM

Comments:

battye added a comment - 31/Jul/20 2:03 PM I'll test and see what happens to approved contributions after deleting the user that added them. The bit you mentioned about posts/topics being left behind, that's the same as described at this ticket isn't it: https://tracker.phpbb.com/projects/CUSTDB/issues/CUSTDB-766

David Colón added a comment - 31/Jul/20 2:18 PM Yes it is. Closed it in lieu of this one.

battye added a comment - 31/Jul/20 3:13 PM - edited I can confirm that if you delete the author of an approve contrib it already sets the owner to Anonymous. And afterwards you can change it to another user:

David Colón added a comment - 31/Jul/20 9:23 PM Perfect, so just a matter of deleting any of their topics, posts, and contributions that don't have any approved revisions.

battye added a comment - 01/Aug/20 3:16 PM Do we care about respecting the "remove" or "retain" values for user deletion through the ACP, when it comes to Titania posts and topics? Or just remove everything from Titania regardless? phpBB's default functionality if the user has 0 forum posts, is to automatically use "retain" which would give us a weird situation if a user happened to have 0 forums posts but had 1+ Titania posts.

3Di [X] (Inactive) added a comment - 01/Aug/20 3:50 PM The question is IMHO: if you delete an user and all that belongs to him goes to ANONYMOUS then if you pass to a specific User ID all of what belongs to ANONYMOUS it is now belonging to that specified User ID. Am I missing something?

battye added a comment - 01/Aug/20 4:06 PM 3Di: we can handle the deletion of Titania posts/topics/contribs before the phpBB user is deleted, so we'd know what the user_id(s) are. This is the logic I've been playing with: https://github.com/battye/customisation-db/commit/30ea88b1a3d78629cdbbf1b7ea7a95f66ab48842

3Di [X] (Inactive) added a comment - 01/Aug/20 4:17 PM - edited Shoudn't it be that you should handle the deletion of Titania posts/topics/contribs AFTER the phpBB user is deleted and adhere to the phpBB's native logic?

Mine is just an opinion BTW, I am dealing with this kind of things for a lot of extensions of us since ages, that's why I am posting here. I am interested about this argument.

battye added a comment - 01/Aug/20 4:29 PM Harder to debug that way, at the moment I can kill the script before the phpBB user is deleted To be honest the reason it goes to Anonymous in Titania is because the phpBB user id is retained in the cdb_ tables but doesn't join to a phpBB user table record any more, so I don't think it would make a difference whether we use delete_user_before or delete_user_after. I think it would do exactly the same thing.

battye added a comment - 01/Aug/20 4:31 PM - edited At the moment my big worries are the delete topics/delete posts code. When I checked the SQL as I was debugging I was getting far more results than I expected. Especially topics, I noticed a topic was removed by a user other than the user being deleted... so that's a problem

3Di [X] (Inactive) added a comment - 01/Aug/20 4:37 PM - edited I'm well aware that Titania from the beginning is not if we want to say it a real extension, so I fully understand and I don't want to go into its code right now. Let it be then, whatever you decide. This point is certainly a bit difficult at first glance, but I repeat I'm not a connoisseur of this specific code and it would take me a lot of time and testing in order to gain a better knowledge. Thank you all the same, battye.

battye added a comment - 02/Aug/20 1:09 PM Conversation to continue at GitHub: https://github.com/phpbb/customisation-db/pull/319