Voting App - dealing with offensive user input


I just started working on the Voting App project, and I noticed that the sample app at has some polls that contain racist, homophobic, or profane language.

That got me wondering how to deal with displaying offensive user input. I believe that some sites use some kind of filtering to replace certain words with asterisks or other obfuscations, and I found several profanity-filter modules on npm.

But I think I would rather implement a type of community moderation where users could flag or downvote polls that are inappropriate. I suppose each poll would have a downvoteCount field in the database, and maybe after 3 downvotes the poll would be automatically deleted? If anyone has implemented this type of functionality before, what libraries or modules were useful, and what were the tricky parts?

Hey @Motardo, glad to see you’re thinking about something like this in your project. While I have not done this project yet myself (React projects for days) one way you could implement this is adding a “Flagged” property in your schema for every poll. When any user renders the page, if your program sees that any page has a flagged property > 3 then it could automatically delete it. Likewise hitting the report button could increment this property in every poll. Just a thought, good luck

1 Like

This would be extremely easy to do with just about any database, with no specialty modules needed. Once you have the UI wired up to issue votes, you can have a cron job (Heroku scheduler, or whatever suites your hosting platform) check the database for all entries with 3 downvotes and then remove them. Of course, you can make the algorithm more complicated by checking for a ratio of downvotes to upvotes, frequency of downvotes, or check for abusive language before deleting downvoted entries. It’s all about queries to get the results you’re after.

Another solution that’s not as smart, but certainly less time consuming, would be to delete all added polls every 24-48 hours and refresh with a standard example set you provide. The assumption here is that you are trying to showcase your work, not give people a serious platform for voting. Aside from saving you a bunch of time, it doesn’t provide the reaction that internet trolls crave, so even if someone does create something nasty, there will be nothing to feed their twisted ego and they’ll likely just move on. Filters and flags are sometimes seen as challenges rather than boundaries by the more puerile elements of society, so ignoring them can reduce the amount of carnage you have to deal with.

1 Like

I really like this idea actually…especially as this would be for our portfolio, how much can / should we depend on community actions which would require a decent amount of traffic…Ive often checked software demos that give login name to test the front /back end of the system, with a notice that all the data resets to default after anywhere from an hour to a day. So Im pretty used to seeing this functionality is use.

Now, for a production ready site that gets a decent amount of traffic, then community policing itself with a voting system to have things automatically removed makes perfect sense… Craigslist works that way actually…

1 Like