From 3aa80c8dc4e8272523eb20bc522cd353e7043767 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 15 Apr 2020 01:10:16 -0500 Subject: [PATCH] Fix #4404: Wrong error message when disapproving an already active post. --- app/models/post_disapproval.rb | 2 +- config/locales/en.yml | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/models/post_disapproval.rb b/app/models/post_disapproval.rb index 3385f7d80..ae18c98b4 100644 --- a/app/models/post_disapproval.rb +++ b/app/models/post_disapproval.rb @@ -4,7 +4,7 @@ class PostDisapproval < ApplicationRecord belongs_to :post belongs_to :user - validates_uniqueness_of :post_id, :scope => [:user_id], :message => "have already hidden this post" + validates :user, uniqueness: { scope: :post, message: "have already hidden this post" } validates_inclusion_of :reason, in: REASONS validate :validate_disapproval diff --git a/config/locales/en.yml b/config/locales/en.yml index 22dfa4464..0dd40d4e4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -55,13 +55,9 @@ en: creator: "You" creator_id: "You" post_disapproval: - post: "You" - post_id: "You" - comment: - post: "You" - post_id: "You" + user: "You" + user_id: "You" comment_vote: - comment: "You" user_id: "You" upload: uploader: "You"