summaryrefslogtreecommitdiff
path: root/app/controllers/snippets_controller.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-02-22 10:13:20 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-02-22 10:13:20 +0000
commit7e8a6a63af2138c5f3f2030ef8c65e8d4815eed3 (patch)
treee33f0190509c5793c67f5589bc455f53a529efc4 /app/controllers/snippets_controller.rb
parent065a52c8144e621f699762b0206a14a010897254 (diff)
parent2ace39f2420abf018ceef6aaad52e4917bcbab7d (diff)
downloadgitlab-ce-7e8a6a63af2138c5f3f2030ef8c65e8d4815eed3.tar.gz
Merge branch '28093-snippet-and-issue-spam-check-on-edit' into 'master'
Spam check and reCAPTCHA improvements Closes #28093 See merge request !9248
Diffstat (limited to 'app/controllers/snippets_controller.rb')
-rw-r--r--app/controllers/snippets_controller.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 445898a2e9e..2d26718873f 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -42,16 +42,19 @@ class SnippetsController < ApplicationController
end
def create
- create_params = snippet_params.merge(request: request)
+ create_params = snippet_params.merge(spammable_params)
+
@snippet = CreateSnippetService.new(nil, current_user, create_params).execute
- respond_with @snippet.becomes(Snippet)
+ recaptcha_check_with_fallback { render :new }
end
def update
- UpdateSnippetService.new(nil, current_user, @snippet,
- snippet_params).execute
- respond_with @snippet.becomes(Snippet)
+ update_params = snippet_params.merge(spammable_params)
+
+ UpdateSnippetService.new(nil, current_user, @snippet, update_params).execute
+
+ recaptcha_check_with_fallback { render :edit }
end
def show