User profile undelete + ability view fix for non-existent profiles#2094
User profile undelete + ability view fix for non-existent profiles#2094Oaphi wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
I wondered how this would interact with deleted users (as opposed to deleted community users). As a moderator I can't restore a user that was deleted network-wide (good), but I'm invited to delete the community profile instead, which is a little confusing. As an admin it's even more confusing (more below).
Sequence:
- admin deletes user network-wide
- mod goes to the user page on the local community (which shows as deleted)
- mod goes to "show all tools" and sees the "danger zone" notice and a button to delete the community profile
Clicking the button appears to work but is nonsensical, and also does not update the timestamp or delete attribution on the profile page, which could be confusing.
If a user was deleted network-wide, can we replace the button and danger-zone notice with text to the effect that this user was deleted network-wide and can't be locally restored, but contact an admin if you think this should be reversed?
Now, switching from a local mod to an admin, I go to the same profile (deleted network-wide), go to "show all tools", and see three buttons:
- undelete community profile (I guess that's because the mod deleted it)
- delete user network-wide (it's already deleted)
- feed to stat (not related to this work, but mentioned for completeness)
For now we should show the same "deleted network-wide, can't be restored" message. We might want to allow admins to restore deleted users, but that's a more complicated case and I'm not sure it's possible as we clobbered the email address. Plus we'd have to decide what to do about community users. So that's more complicated and let's not try to handle it in this PR.
Summary: in this PR let's
- prevent mods from acting on users who were deleted network-wide
- not offer restoration buttons to admins through the UI in this case
- add some tests that use network-deleted users
Let's keep treating network-wide user deletion as irreversible, at least for the time being - we do clobber both the email and the password, after all. As for the rest - yea, won't hurt to handle the "deleted everywhere, not just on this community" case better while I am at it, will do |
This PR adds a reversal moderation action of restoring soft-deleted community profiles with the same button that deletes them (might come in handy as we don't have any form of confirmation of such actions). Restoration is audited, so I don't see any issues with having it.
In addition (and what is the main purpose of the PR) is to fix server error when trying to view an ability page for a user with the prorifle not present on the community. That's not supposed to happen anymore but data errors can lead to this + we expect that in other checks in the view, it's just that this specific one is outdated.