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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-29 03:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-29 03:09:17 +0300
commit5fe1957d2bd0c3f969f357b17f4b46f1968d8810 (patch)
treec3819660f860c4fc87d9ac9f22ad08894bb143fb /app/models/concerns/spammable.rb
parentc6c346e8c7f0865f0016a458511e9fabfc8b9c1a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns/spammable.rb')
-rw-r--r--app/models/concerns/spammable.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb
index 9cd1a22b203..2daea388939 100644
--- a/app/models/concerns/spammable.rb
+++ b/app/models/concerns/spammable.rb
@@ -45,6 +45,17 @@ module Spammable
self.needs_recaptcha = true
end
+ ##
+ # Indicates if a recaptcha should be rendered before allowing this model to be saved.
+ #
+ def render_recaptcha?
+ return false unless Gitlab::Recaptcha.enabled?
+
+ return false if self.errors.count > 1 # captcha should not be rendered if are still other errors
+
+ self.needs_recaptcha?
+ end
+
def spam!
self.spam = true
end