diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-02-14 17:07:11 -0200 |
---|---|---|
committer | Oswaldo Ferreira <oswluizf@gmail.com> | 2017-02-21 13:32:49 -0300 |
commit | 2ace39f2420abf018ceef6aaad52e4917bcbab7d (patch) | |
tree | cae709a6381c80c70af5da459c3ffa992593843d /lib/api/snippets.rb | |
parent | 881529495379505542033bf7fb0d91cdc5b51e8d (diff) | |
download | gitlab-ce-2ace39f2420abf018ceef6aaad52e4917bcbab7d.tar.gz |
Spam check and reCAPTCHA improvements28093-snippet-and-issue-spam-check-on-edit
Diffstat (limited to 'lib/api/snippets.rb')
-rw-r--r-- | lib/api/snippets.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb index eb9ece49e7f..ac03fbd2a3d 100644 --- a/lib/api/snippets.rb +++ b/lib/api/snippets.rb @@ -67,6 +67,8 @@ module API attrs = declared_params(include_missing: false).merge(request: request, api: true) snippet = CreateSnippetService.new(nil, current_user, attrs).execute + render_spam_error! if snippet.spam? + if snippet.persisted? present snippet, with: Entities::PersonalSnippet else @@ -93,9 +95,12 @@ module API return not_found!('Snippet') unless snippet authorize! :update_personal_snippet, snippet - attrs = declared_params(include_missing: false) + attrs = declared_params(include_missing: false).merge(request: request, api: true) UpdateSnippetService.new(nil, current_user, snippet, attrs).execute + + render_spam_error! if snippet.spam? + if snippet.persisted? present snippet, with: Entities::PersonalSnippet else |