Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/spammable.rb')
-rw-r--r--app/models/concerns/spammable.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb
index 4901cd832ff..b475eb79aa3 100644
--- a/app/models/concerns/spammable.rb
+++ b/app/models/concerns/spammable.rb
@@ -12,7 +12,7 @@ module Spammable
included do
has_one :user_agent_detail, as: :subject, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
- attr_accessor :spam
+ attr_writer :spam
attr_accessor :needs_recaptcha
attr_accessor :spam_log
@@ -29,6 +29,10 @@ module Spammable
delegate :ip_address, :user_agent, to: :user_agent_detail, allow_nil: true
end
+ def spam
+ !!@spam # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ end
+
def submittable_as_spam_by?(current_user)
current_user && current_user.admin? && submittable_as_spam?
end
@@ -74,8 +78,9 @@ module Spammable
end
def recaptcha_error!
- self.errors.add(:base, "Your #{spammable_entity_type} has been recognized as spam. "\
- "Please, change the content or solve the reCAPTCHA to proceed.")
+ self.errors.add(:base, _("Your %{spammable_entity_type} has been recognized as spam. "\
+ "Please, change the content or solve the reCAPTCHA to proceed.") \
+ % { spammable_entity_type: spammable_entity_type })
end
def unrecoverable_spam_error!