-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Soft delete users #3726
Soft delete users #3726
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great! One comment about the UserHistory
in combination with deleted_at
, and see some tests are failing
contentcuration/contentcuration/migrations/0141_user_soft_delete.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one more test would be good to give confidence here.
files = File.objects.filter(contentnode__in=contentnode_ids) | ||
files_on_storage = files.values_list("file_on_disk", flat=True) | ||
|
||
for disk_file_path in files_on_storage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reinstating the file deletion behaviour here does make sense in the context of the PR - but would be good to have some tests on this function just to guarantee that we are definitely not deleting files that are being used in other channels - regardless of how simple the code may seem here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reinstation of file deletion plays a critical role in garbage collection so I was determined to make sure it doesn't bring in bad things.
Thankfully, there were tests already written for the case when two contentnodes share the same file and there are more file deletion test cases under CleanUpContentNodesTestCase
that cover other behaviours also:
class CleanUpContentNodesTestCase(StudioTestCase): |
studio/contentcuration/contentcuration/tests/utils/test_garbage_collect.py
Lines 237 to 241 in 172eb66
def test_doesnt_delete_shared_files(self): | |
""" | |
Make sure that a file shared between two file objects doesn't | |
get deleted when one of the file objects gets deleted | |
""" |
I have made sure that changing the file deletion behaviour fails the above tests. Since the current code passes the above tests, I am confident with my changes.
@rtibbles sir, if you think there's a case that's remaining to be tested...? then I'll definitely love to write test for that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rtibbles umm, sir, thoughts?
Just a note that I've done some code review and testing of this, and so far everything is good. I still need to test the delayed portion |
Yes @bjester sir please take your time. |
I believe you mentioned this to me at one point, @vkWeb, but I don't think I understood-- seems that the copy in the user's account is a bit misleading:
If you've added an editor to the referenced channels, you still can't delete your account. It's wholly unrelated to your feature work here though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to remove the user from any channel's editors after the 90 day period, but I'm not sure if there are consequences to that. We could implement that another time.
Summary
Brings in user soft delete. User account data is kept intact. Recovery of user account is now possible. 🎉
Manual verification steps performed
user.recover()
user can login after email verification.user.recover()
user can register after email verification. (behaves same as invitation workflow)Reviewer guidance
Does manual verification mentioned above works on your end?
References
Closes #1990.
Contributor's Checklist
PR process:
CHANGELOG
label been added to this PR. Note: items with this label will be added to the CHANGELOG at a later timedocs
label has been added if this introduces a change that needs to be updated in the user docs?requirements.txt
files also included in this PRStudio-specifc:
notranslate
class been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)pages
,components
, andlayouts
directories as described in the docsTesting:
Reviewer's Checklist
This section is for reviewers to fill out.
yarn
andpip
)