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

[Feature] Banning System #30

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

[Feature] Banning System #30

wants to merge 5 commits into from

Conversation

Bukii
Copy link
Member

@Bukii Bukii commented Feb 2, 2021

Description

Basically, I've added two endpoints for our Discord bot to call. That's a temporary fix for banning users. Later on a report button will be added to the frontend, so people don't have to be on Discord in order for them to report someone.
The API endpoint identifies the requestor as a bot, because they share the same token. Therefore, it's only possible for our bot to perform a ban on someone. Additionally, only users with the role of a Moderator on our Discord can interact with the bot at all.
To the endpoints, there's the ban endpoint, which takes a username to get the full User object and then inserts the userId as well as the githubId in the "Banned" table. Also, the user itself has a column named isBanned, which will be set to true during the api call.
Then, there's a delete-stories endpoint. All it does, it deletes all the stories from the given user. It's especially for users, that post porn for instance.

Related Issue

Temporary fix for report button next to heart

Motivation and Context

Since gif stories is currently a work in progress and last time gif stories was a thing, it got abused, there need to be a report system. Also, we are getting reports on our Discord server, which need to be fixed asap.

How Has This Been Tested?

Postman Test

After setting up the endpoints like they are now, I've opened Postman to check if everything is alright and each endpoint is responding how it should be. Also, tried removing the bot-access-token header to see if there's a difference.

Extension Test

In order to see if the isAuth() change is working as expected, I created a story, while not having the isBanned check implemented, then uncommented it and tried to like my own story. It was responding with an error message on the bottom right and it displayed the You are banned! If you think the ban isn't rightful, then you can challenge the ban on our Discord server. https://discord.gg/ABpGdRxvaA text. Everything worked out.

Final Bot Test

For the ultimate test, I've called both endpoints via messaging the bot on Discord. After calling the ban endpoint, the Banned table had the correct ids inserted and the user in the user table also got updated correctly (isBanned --> true). The delete-stories endpoint was also doing fine, but GifStory.delete() threw an error. Luckily that's no problem since the gifStory table doesn't exist yet.

@TheFern2
Copy link
Contributor

TheFern2 commented Feb 3, 2021

Looks like we a few bugs:

I banned one of my github users, he was added to Banned table and isBanned turn true.

  • I was able to post a story even after I was banned
  • Doing a reauth changes isBanned from true to false (fixed this on passport github strategy, isBanned was getting reset to false on reauth)

Working fine:

  • delete stories (gif_story will be fixed when I merge the gifStory feature)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants