Skip to content

Commit

Permalink
Adjust the default score for comments made by user with a negative karma
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Oct 28, 2011
1 parent 84368f5 commit 46b7126
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/comment.rb
Expand Up @@ -109,7 +109,11 @@ def answer_to_self?

before_validation :default_score, :on => :create
def default_score
self.score = Math.log10([user.account.karma, 0.1].max).to_i - 1
if user.account.karma > 0
self.score = Math.log10(user.account.karma).to_i - 1
else
self.score = [-2 + user.account.karma/30, -10].max
end
end

def nb_answers
Expand Down
3 changes: 3 additions & 0 deletions app/views/comments/new.html.haml
Expand Up @@ -7,6 +7,9 @@
%ul.threads
%li.comment{comment_attr(@comment.parent)}
= render @comment.parent
- if @comment.parent.try(:score) == -10
.notice
%strong Do not feed the troll!
- else
= render @comment.node.content

Expand Down

0 comments on commit 46b7126

Please sign in to comment.