diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-29 03:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-29 03:09:17 +0300 |
commit | 5fe1957d2bd0c3f969f357b17f4b46f1968d8810 (patch) | |
tree | c3819660f860c4fc87d9ac9f22ad08894bb143fb /app/models | |
parent | c6c346e8c7f0865f0016a458511e9fabfc8b9c1a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/spammable.rb | 11 |
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 |