fixes #744
This commit is contained in:
@@ -5,7 +5,7 @@ class CommentVote < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
before_validation :initialize_user, :on => :create
|
||||
validates_presence_of :user_id, :comment_id, :score
|
||||
validates_uniqueness_of :user_id, :scope => :comment_id, :message => "has already voted for this comment"
|
||||
validates_uniqueness_of :user_id, :scope => :comment_id, :message => "have already voted for this comment"
|
||||
validate :validate_user_can_vote
|
||||
validate :validate_comment_can_be_down_voted
|
||||
validates_inclusion_of :score, :in => [-1, 1], :message => "must be 1 or -1"
|
||||
@@ -27,7 +27,7 @@ class CommentVote < ActiveRecord::Base
|
||||
|
||||
def validate_user_can_vote
|
||||
if !user.can_comment_vote?
|
||||
errors.add :user, "can not comment vote"
|
||||
errors.add :base, "You cannot vote on comments"
|
||||
false
|
||||
else
|
||||
true
|
||||
@@ -36,7 +36,7 @@ class CommentVote < ActiveRecord::Base
|
||||
|
||||
def validate_comment_can_be_down_voted
|
||||
if is_negative? && comment.creator.is_janitor?
|
||||
errors.add :user, "can not downvote a janitor comment"
|
||||
errors.add :base, "You cannot downvote a janitor comment"
|
||||
false
|
||||
else
|
||||
true
|
||||
|
||||
@@ -19,4 +19,10 @@ en:
|
||||
creator_id: "You"
|
||||
post_disapproval:
|
||||
post: "You"
|
||||
post_id: "You"
|
||||
post_id: "You"
|
||||
comment:
|
||||
post: "You"
|
||||
post_id: "You"
|
||||
comment_vote:
|
||||
comment: "You"
|
||||
user_id: "You"
|
||||
Reference in New Issue
Block a user