Whether to allow comments on a post can be a controversial subject – if you allow them, they can turn into a mess of irrelevance, or worse. On the other hand, comments can promote engagement, conversations, and add value to the story. Especially when the discussion is civil and relevant to the topic of the post.
One way to make user comments a bit more effective and relevant is to use thumbs up or down voting buttons, either rating the commenter or the comment. This is user-driven moderation, and while it sounds good in principle, sometimes it is seen as a device for voting down opposing viewpoints, which doesn’t necessarily improve a discussion.
Here on True/Slant, member comments are curated by contributors and editors. Good, relevant comments are typically the ones that get called out; comments that don’t contribute to the conversation are not. Comment threads are by default filtered by this rating, but users can switch to an all-comments view.
So how does this comment curation work, technically?
Generally, we expose a control to only the contributors; when they click on the control, an AJAX request is sent, the database is updated, and the response causes the current comment’s class to change. CSS does the rest. Here’s the code…