Skip to content

User profile undelete + ability view fix for non-existent profiles#2094

Open
Oaphi wants to merge 3 commits into
developfrom
0valt/ability-show-hotfix
Open

User profile undelete + ability view fix for non-existent profiles#2094
Oaphi wants to merge 3 commits into
developfrom
0valt/ability-show-hotfix

Conversation

@Oaphi

@Oaphi Oaphi commented Jul 15, 2026

Copy link
Copy Markdown
Member

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.

@Oaphi
Oaphi requested review from ArtOfCode- and cellio July 15, 2026 13:00
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.94%. Comparing base (ac82d70) to head (39f7c38).

Files with missing lines Patch % Lines
app/controllers/users_controller.rb 85.71% 1 Missing ⚠️
Additional details and impacted files
Components Coverage Δ
controllers 76.76% <85.71%> (+<0.01%) ⬆️
helpers 85.47% <ø> (ø)
jobs 77.43% <ø> (ø)
models 93.14% <100.00%> (+0.01%) ⬆️
tasks 61.11% <ø> (ø)

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cellio cellio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Oaphi

Oaphi commented Jul 18, 2026

Copy link
Copy Markdown
Member Author

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants