diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-10 12:08:16 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-10 12:08:16 +0000 |
commit | 1fa79760ad2d4bd67f5c5a27f372a7533b9b7c69 (patch) | |
tree | ffdfbd9113743831ff4f1290959a62cf6567fde5 /app/controllers/projects/snippets_controller.rb | |
parent | 82fa8a3d1e8466ef36b58604d20fcc145ea12118 (diff) | |
download | gitlab-ce-1fa79760ad2d4bd67f5c5a27f372a7533b9b7c69.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/snippets_controller.rb')
-rw-r--r-- | app/controllers/projects/snippets_controller.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 241df8d95d7..48cd42347fc 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -52,8 +52,15 @@ class Projects::SnippetsController < Projects::ApplicationController create_params = snippet_params.merge(spammable_params) service_response = Snippets::CreateService.new(project, current_user, create_params).execute @snippet = service_response.payload[:snippet] + repository_operation_error = service_response.error? && !@snippet.persisted? && @snippet.valid? - recaptcha_check_with_fallback { render :new } + if repository_operation_error + flash.now[:alert] = service_response.message + + render :new + else + recaptcha_check_with_fallback { render :new } + end end def update |