Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create/Update Models for Moderation #21

Closed
22 tasks
Breadkenty opened this issue Aug 15, 2020 · 7 comments · Fixed by #26
Closed
22 tasks

Create/Update Models for Moderation #21

Breadkenty opened this issue Aug 15, 2020 · 7 comments · Fixed by #26
Assignees
Labels
enhancement New feature or request Priority Needs to be worked right away

Comments

@Breadkenty
Copy link
Owner

Breadkenty commented Aug 15, 2020

We're updating the models to implement the moderation feature. I only have a few concerns about this model and if you see any problems please post them here. One primary issue is having two foreign keys for UserId labeled as UserId and Reporter/ModeratorId. Please check out the UI to see how this will be implemented in #15

Update User Model

  • Add int UserStatus = 1. This model will be responsible for determining the rank of the user. 3 for admin, 2 for mods, 1 for users. Make this property private.
  • Add List<Combo>Combos. This will allow the UI to see the user page with all of their reports for a Combo.
  • Add List<Comments>Comments. This will allow the UI to see the user page with all of their reports for a comment
  • Add List<Infraction>Infraction. This will allow the UI to see the user page with their infractions

Update Combo Model

  • Add List<Report>Reports. People will report combos

*Update Comment Model

  • Add List<Report>Reports. People will report comments

Create Report Model

  • int Id
  • int UserId (The id of the user being reported)
  • int ReporterId (The id of the creating the report)
  • string Body[required]
  • DateTime DateReported = DateTime.Now() (make this private)
  • bool Dismiss = false

Create Infraction Model

  • int Id
  • int UserId (The id of the user being infracted)
  • int ModeratorId (The id of the user/moderator giving the infraction)
  • int banDuration = 0(this int will be in seconds)
  • type[required]
  • int Points = 0 (make this private)
  • string body[required]
  • DateTime DateInfracted = DateTime.Now() (make this private)

  • Create Migrations
  • Test to make sure the two UserId and Reporter/ModeratorId in the Report and Infraction model works as foreign keys.
@Breadkenty Breadkenty added enhancement New feature or request Priority Needs to be worked right away labels Aug 15, 2020
@agoodnap
Copy link
Collaborator

agoodnap commented Aug 15, 2020

I think holding the banDuration as an int (seconds) would be nicer, together with DateInfracted we could always get the exact end-date of a ban by adding the seconds to the DateInfracted date (a method the DateTime class provides)

So when we handle a user login we could check if they have any infractions where this calculated date is still in the future - > ergo they're still banned.

This way we wouldn't need isBan, since we can simply check if banDuration is 0. (I mentioned this in #23 too) If it is, the infraction was just a warning. (this would also work if we keep it a string(check for null or empty) , so if you don't agree with the above change still consider this one)

@Breadkenty
Copy link
Owner Author

I definitely like that approach better, I'll fix it on the issue here. Thanks!

@agoodnap
Copy link
Collaborator

agoodnap commented Aug 15, 2020

One issue that we would need to think about is permanent bans, since we cant represent those this way... (unless we just set the ban duration to int.MaxValue, but that doesn't seem too clean) Just thought of this, any ideas for that?

I guess we could also add a boolean isPermanent... Or just delete the User on perman bans and add their email to a blacklist? Seems a bit excessive though, since they may have submitted good combos even though they got banned and then those would be deleted. Or we set the banDuration to a negative value (-1) if its permanent and check for that, but that feels a bit hack-y... Just throwing ideas around here.

@skittlz444
Copy link
Collaborator

I don't think you could have combo and comment id on report. You'll be able to access the report from the combo or comment respectively. This will stop the report object from getting unnecessarily bloated with ids.

@Breadkenty
Copy link
Owner Author

Yeah I was starting to feel that these models are looking messy with IDs that way. I'll remove it here. I wonder if we can just set the perma-bans to something unnecessarily long?

@agoodnap
Copy link
Collaborator

agoodnap commented Aug 16, 2020

We could set them to int.MaxValue and check for that, longer is impossible unless we change the data type, unless we treat the banTime not as seconds but days or something, that would work too.

@agoodnap
Copy link
Collaborator

Anyway, I'll get started on this now and have a pull request up soon for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority Needs to be worked right away
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants