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:
authorSean McGivern <sean@gitlab.com>2017-02-01 21:15:59 +0300
committerSean McGivern <sean@gitlab.com>2017-02-02 13:23:51 +0300
commitc63194ce6f952173649d7de4038aa96348e90565 (patch)
treea9622e1e5ffc86bf35fc9556152cc03cf2841ef5 /app/models/concerns/spammable.rb
parentf799585c41d801bc657f992adf3d4b201af927d2 (diff)
Check public snippets for spam
Apply the same spam checks to public snippets (either personal snippets that are public, or public snippets on public projects) as to issues on public projects.
Diffstat (limited to 'app/models/concerns/spammable.rb')
-rw-r--r--app/models/concerns/spammable.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb
index 1aa97debe42..1acff093aa1 100644
--- a/app/models/concerns/spammable.rb
+++ b/app/models/concerns/spammable.rb
@@ -34,7 +34,13 @@ module Spammable
end
def check_for_spam
- self.errors.add(:base, "Your #{self.class.name.underscore} has been recognized as spam and has been discarded.") if spam?
+ if spam?
+ self.errors.add(:base, "Your #{spammable_entity_type} has been recognized as spam and has been discarded.")
+ end
+ end
+
+ def spammable_entity_type
+ self.class.name.underscore
end
def spam_title