summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-12-11 11:26:08 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-12-11 11:26:08 +0000
commit689bc9ea6db102006b548e6176125157955c7f2b (patch)
treea84f5135c4476ab56293b21bb148dc7bae3372d8
parent980df271899a8c06024bce5a7939093c8865afd5 (diff)
parent0e935c76061e9e5b2ef0a196637602f3720b23d7 (diff)
downloadgitlab-ce-689bc9ea6db102006b548e6176125157955c7f2b.tar.gz
Merge branch 'recaptcha_check_if_spammable_ce_backport' into 'master'
Add recaptcha_check_if_spammable for issualbes than arent spammables See merge request gitlab-org/gitlab-ce!15817
-rw-r--r--app/controllers/concerns/issuable_actions.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb
index ecac9be0360..281756af57a 100644
--- a/app/controllers/concerns/issuable_actions.rb
+++ b/app/controllers/concerns/issuable_actions.rb
@@ -21,11 +21,11 @@ module IssuableActions
respond_to do |format|
format.html do
- recaptcha_check_with_fallback { render :edit }
+ recaptcha_check_if_spammable { render :edit }
end
format.json do
- recaptcha_check_with_fallback(false) { render_entity_json }
+ recaptcha_check_if_spammable(false) { render_entity_json }
end
end
@@ -80,6 +80,12 @@ module IssuableActions
private
+ def recaptcha_check_if_spammable(should_redirect = true, &block)
+ return yield unless @issuable.is_a? Spammable
+
+ recaptcha_check_with_fallback(should_redirect, &block)
+ end
+
def render_conflict_response
respond_to do |format|
format.html do