From 9f313c94d18e8b2e62c49f7152b05a4182250499 Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 21 Jan 2021 02:27:30 -0600 Subject: [PATCH] comments: remove rule that you can't upvote your own comments. Remove this rule for several reasons: * A single upvote usually isn't enough to matter, especially with the new comment threshold. * It felt weird that trying to vote on a comment could fail. * Disabling the upvote button on your own comments feels weird. * Most other sites allow you to upvote your own comments. * You're allowed to upvote your own uploads, so it doesn't make sense that you can't upvote your own comments. --- CHANGELOG.md | 2 ++ app/models/comment_vote.rb | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cb22f852..13300f1a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ * The maximum comment threshold is now 5 and the minumum threshold is now -100. You can't set your threshold any higher or lower than this. +* Removed the rule that you can't upvote your own comments. + * Changed the way [quote] tags look. Now quotes are Reddit-style instead of traditional forum style. diff --git a/app/models/comment_vote.rb b/app/models/comment_vote.rb index 29d6c4464..4da57de96 100644 --- a/app/models/comment_vote.rb +++ b/app/models/comment_vote.rb @@ -4,7 +4,6 @@ class CommentVote < ApplicationRecord validates_presence_of :score validates_uniqueness_of :user_id, :scope => :comment_id, :message => "have already voted for this comment" - validate :validate_comment_can_be_down_voted validates_inclusion_of :score, :in => [-1, 1], :message => "must be 1 or -1" after_create :update_score_after_create @@ -25,12 +24,6 @@ class CommentVote < ApplicationRecord q.apply_default_order(params) end - def validate_comment_can_be_down_voted - if is_positive? && comment.creator == CurrentUser.user - errors.add(:base, "You cannot upvote your own comments") - end - end - def is_positive? score == 1 end