Join GitHub today
[Fix #4576] Do not delete projects which have multiple users #4577
These changes look good.
I test these queries (old and new ones) in production DB and the new ones return what is expected.
Although, by checking the underline SQL code executed I wasn't able to fully understand the difference
Nice catch! I still don't fully understand the fix so we might need some more thorough tests to ensure this does not happen again.
Overall, this is a good fix.
At some level, this bug was a mismatch between the expectations of the user and reality. One thing that would clear this up is to show on the delete screen exactly what is going to be removed by a user deleting their account (at least the projects). The Django Admin does this and I think it's a good pattern. That way there are fewer surprises.
Showing changes would be interesting. Though:
Fixing the logic here i think matches user expectations at least
I like @davidfischer's idea about showing what's going to delete. Although, I think we can implement that in another PR and merge this fix soon since it's an important bug and may cause more nightmares to us dealing with the backups.
Also, I'd like to think and discuss a little more about what to show. On one side, I suppose that showing the Projects to be deleted is enough, but that seems to be the "common sense" thought and maybe doesn't worth to make it explicit. On another side, I don't want to go too verbose, as @agjohnson said.
Maybe we can take a look at what other services do for a similar flow.
I think only showing the projects is good. If deleting their account means deleting a lot of projects I think it would be nice to know that.
This is not quite correct. Deleting a user in the admin would not delete any projects. We implemented custom logic to delete projects based on a signal. If we plan to only show which projects are deleted, then we only need to copy our own logic.