From 335e1fd0c43313c0ead7f3499b22e081f93e6c28 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Thu, 3 Nov 2016 16:20:39 -0500 Subject: [PATCH] User: experiment with a minimum karma required to downvote comments --- app/models/user.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index a8122f5..6fc1a4d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -64,6 +64,9 @@ class User < ActiveRecord::Base # minimum karma required to be able to offer title/tag suggestions MIN_KARMA_TO_SUGGEST = 10 + # minimum karma required to be able to downvote comments + MIN_KARMA_TO_DOWNVOTE = 100 + # minimum karma required to be able to submit new stories MIN_KARMA_TO_SUBMIT_STORIES = -4 @@ -174,8 +177,7 @@ class User < ActiveRecord::Base return true end elsif obj.is_a?(Comment) - # XXX - return false + return !self.is_new? && (self.karma >= MIN_KARMA_TO_DOWNVOTE) end false