sendou.ink icon indicating copy to clipboard operation
sendou.ink copied to clipboard

Allow users to delete their account and profile

Open remmycat opened this issue 1 year ago • 1 comments

I think currently there is no option to delete a user profile without manual operations on the database, which isn't very user friendly.

I believe there should be an option for this on the edit profile page, that obviously warns the users and asks for confirmation.

Prerequisites

From a db perspective there are some table entries that would currently prevent a deletion of a user (via user ID foreign key with on delete restrict), we would need to decide how to handle these

CalendarEvent

  • If we changed this to on delete cascade, this would mean that the whole event would be deleted, which is probably not what we want in all cases.
  • It's probably safe to delete any events that are in the future and have no results recorded
  • For (partially) past events we could try to scrub the author data
    • Set description to null
    • Set author id to null (needs to be nullable, this would need changes in all the queries and code that expect all events to have a connected user)
  • Alternatively let people transfer ownership when deleting their account (Probably easier to code around)
    • The user who is deleting their account could optionally pick a different user to transfer their events to
    • If none is entered the events and connected results would be deleted

CalendarEventResultPlayer

  • It would probably make sense to just update the results from a user-connected result to a name-only result (based on the discord name or something like "Deleted Account"?)

Build

  • I don't see a reason not to change builds to on delete cascade

PlusSuggestion

  • This is currently set to on delete cascade for the author ID
  • I could see a case where this becomes an issue for suggestions that have already received votes before the suggesting person removed their account for whatever reason? Or at least for suggestions that have already passed the vote and are now not listed on the result list anymore.
  • Not sure what would be the right move here, make the author id optional and highlight it as being suggested by a deleted account?

PlusVote

  • This is also set to on delete cascade for the author ID
  • This seems predestined for drama if the voter gets deleted after the voting is over.
  • I believe if the score changes into the negative after voting is over, this would currently change voting results after the fact
  • Possible solution could be to persist voting results in the database at the cutoff date, instead of only creating a view in the db that references the PlusVote table.

Any thoughts on these ideas, especially the open questions?

remmycat avatar Oct 19 '22 10:10 remmycat

Great idea!

So here is what I'm thinking.

  • Should make it so that it's impossible to do it by accident.
  • Maybe let's keep the row in User table. Just put values like "Deleted user" and placeholder Discord ID e.g. user id prefixed with bunch of 9's or something. Then ofc set everything to NULL that can be. Inspiration from how Discord does it? Gotta make sure can't access user page of these "zombie users" though.
image
  • PlusSuggestion I would not touch these due to risks of messing up voting. + they are not permanent. Every month plus suggestions shown are cleared anyway.
  • PlusVote leave untouched due to messing up voting.
  • badge related ones could be deleted
  • CalendarEventResultPlayer you had a nice idea there.
  • CalendarEvent if in future, delete.
  • Build delete either via DB cascade or normal SQL statement. Whichever works.

So basically agreeing with what you said :)

Sendouc avatar Oct 19 '22 19:10 Sendouc