[CUSTDB-804] Better handling of user delete #319
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wanted to create a draft PR of this change because there's more visibility on GitHub rather than JIRA, so a bit easier to discuss changes. I still want to do more testing on this too, more on that below.
The basic idea behind this change, is that when a user is deleted in phpBB we will also handle their data removal in Titania:
When deleting a user in phpBB, there will also be a message to indicate Titania data will be affected (I couldn't find an event to put the same message for pruning users unfortunately):
My questions
Do we want any restrictions on the Titania posts/topics that are removed? I've currently restricted it to support topics, because I feel like we should be keeping the queue discussion topic if we have a contribution with an approved revision.
Should we be deleting topics made by the user? What if they posted something which generated an important conversation?
Should we respect the retain/remove flags from phpBB when considering whether to delete Titania posts/topics? At the moment I've just got it to delete from Titania regardless, but it's easy to change it so that it only does that if "remove" is selected in phpBB.
I'm worried about these 2 SQL queries: delete topics sql and delete posts sql
My eyes might have been deceiving me (it was late when I was testing yesterday 😛) but I think I saw an example where a topic created by another user (but replied to by the user I was deleting) ended up being removed. So I'm worried there's some logic behind
topic_first_post_user_id
that I'm unaware of; or perhaps something funny in$topic->delete()
. I couldn't replicate the problem when I tried it today, all the posts and topics being removed were as I expected. But nonetheless I want to test that area some more, and I'm hopeful someone else might have an idea of what might have happened.https://tracker.phpbb.com/browse/CUSTDB-804