qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

Link to deleted user profile page available to users from reaction

Open trichoplax opened this issue 1 year ago • 3 comments

Describe the bug If a user adds a reaction to a post and that user is then deleted, the reaction still shows their username, and clicking on it allows navigating to their profile page. To a user, this profile page will contain no information, but this is inconsistent with everywhere else that a deleted username shows.

Expected behavior The reaction should show "deleted user" instead of the username, and there should be no link to the user profile for standard users.

A link may be required for moderators - see #1416

trichoplax avatar Sep 27 '24 13:09 trichoplax

Let's remove reactions upon account deletion. The whole point of a reaction is to make a public, attributed assertion -- "who says so?" is an important part of the feature.

cellio avatar Sep 27 '24 15:09 cellio

Is there likely to be account reinstatement in future? I can't see a way to do it through the interface at present, but if in future it becomes possible, would we want old removed reactions to reappear? If we remove them by setting a flag rather than deleting the database row, then reactions will be free to return in future if that's ever decided to be desired.

trichoplax avatar Sep 27 '24 15:09 trichoplax

That's a good point. Withholding (in the UI) is better than deleting the data. (I don't know if a UI "is deleted?" check is fine or if we should add a "hide?" column to the relevant table, but either way, let's preserve the data in case it's needed later.)

cellio avatar Sep 27 '24 15:09 cellio

I tried to figure out how to hide these without changing data (or the DB schema). I didn't succeed, but here are some notes for the next person who looks at it:

The code that displays the reactions (like "worked for UserA, deleted user, UserC") is in views/reactions/_list.html.erb. That code has to handle multiple reaction types and then the reactions within each type. So it starts by getting the types that are present on the post, and then for each, gets the list of names.

We would like to suppress deleted users. We also need to bubble that up to the types list, though, because if a reaction type (like "works for") exists, but all reactors are deleted, we don't want to process that at all. But checking for deleted users in two different places is probably not good, so we probably want to ask the model...something. Which also needs to account for the current user being allowed to see them anyway (moderator).

Also, in the modal table of all reactors, comments, and dates for a particular reaction type, deleted users show up as links, but clicking on them reloads the post page if you're not a moderator. (For moderators it's a valid link.) Depending on where/how we do the checks for deleted users, we'll need to apply them to that table, too. At the very least, we shouldn't present a link we're not going to handle -- but since we want to remove deleted users from the list entirely, it's not worth trying to do something clever with the links (the whole table row would go away when we fix the larger issue).

cellio avatar Oct 09 '25 20:10 cellio