Repository navigation
Conversation
vaibhavsingh97
left a comment
There was a problem hiding this comment.
Agreed, thanks for the PR. LGTM 🎉
|
I intentionally made these separate tables for the use case that a user leaves an organization, deletes their account, or something similar we can still easily maintain the ban information. But I'm also open to this if y'all think it'd be better 👍 |
I think that's a good reason actually. We could handle that by not allowing the user to leave a group where he or she is banned; and also we won't show the user in the list of members if the banned flag is true. In the case of account deletion then maintaining the ban record won't give any information since we won't have any information of the banned user (unless we use soft deletes). I can see advantages in both approaches, I'm personally 65% in favor of using the same table with the |
| create table user_groups ( | ||
| user_id uuid references users(id), | ||
| group_id uuid references groups(id), | ||
| banned boolean default false, |
There was a problem hiding this comment.
It would be useful to convert this into a date time field, so we can keep track of how many time an user has been banned. In the future we could also implement auto unbans (or temporal bans).
banned_at == <ANY DATE>would mean the user is bannedbanned_at == nullwould mean user is not banned
| banned boolean default false, | |
| banned_at timestamptz, |
There was a problem hiding this comment.
I totally agree with this change. @dmmulroy @vaibhavsingh97 What do you guys think?
There was a problem hiding this comment.
we can keep track of how many time an user has been banned.
banned_at field will be updated many times, so how can we track if the user is banned 1 time or 2 times? We will only get the last banned date if we are using timestampz
In the future we could also implement auto unbans (or temporal bans).
So probably we will need to have a separate table for this thing as then we have too many things to consider. Also, maintaining another table will record logs like the reason for banning, no. of times a user gets banned, also the state of ban i.e temp/permanent.
|
|
This change only allows for users to be banned from a group |
|
Oops you're right, misread the table name. Edited my comment. |
|
I prefer the separate table for a few reasons:
I don't want to pollute this PR with the topic or reasons, I'm just including it to illustrate why this PR is not going in the direction I think the schema should: |
|
I prefer a separate table for the reason named. We should be able to keep track of multi bans and information regarding those bans. In addition, a bans table allows a user to be removed from the organization, and we don't have to do any weird one off things like not allow a user to leave an org because they are banned. |
|
I agree with using a separate ban table. Is this an MVP feature? Maybe not since we need to verify users (phone number?) so a banned person doesn't just create a new account with an alternate email address. Either way, if I'm understanding all correctly, sounds like this PR needs to be closed. |
|
@ceciliaconsta3 Yes indeed banning a user is an MVP feature. I agree with you all that we should keep Closing this as the consensus is: Banned users should be in separate table. Thanks, @midned for trying to help us. This was your first time here so I know it feels bad to see your PR closed but don't worry we need a ton of help in implementing MVP features. You can find issues we need help with here :) |
With this we can avoid using an extra table for banning users from groups.
We can actually use the already-existent pivot table to hold that information