summaryrefslogtreecommitdiff
path: root/lib/api/helpers/internal_helpers.rb
diff options
context:
space:
mode:
authorMarcia Ramos <virtua.creative@gmail.com>2019-04-10 17:05:46 +0100
committerMarcia Ramos <virtua.creative@gmail.com>2019-04-10 17:05:46 +0100
commitcbd6841cac8185f181a5dcec33704f6e7c040732 (patch)
tree423bbc4fb873ab51590d0be4ae594769c80b739b /lib/api/helpers/internal_helpers.rb
parent3402f8c817e9798eed9d86555f3f85fd10f49abf (diff)
parent490b31f740d23b54a62588cd9fd0e0cf7fdd9370 (diff)
downloadgitlab-ce-docs-pages-intro.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into docs-pages-introdocs-pages-intro
Diffstat (limited to 'lib/api/helpers/internal_helpers.rb')
-rw-r--r--lib/api/helpers/internal_helpers.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb
index 3fd824877ae..71c30ec99a5 100644
--- a/lib/api/helpers/internal_helpers.rb
+++ b/lib/api/helpers/internal_helpers.rb
@@ -43,6 +43,28 @@ module API
::MergeRequests::GetUrlsService.new(project).execute(params[:changes])
end
+ def process_mr_push_options(push_options, project, user, changes)
+ output = {}
+
+ service = ::MergeRequests::PushOptionsHandlerService.new(
+ project,
+ user,
+ changes,
+ push_options
+ ).execute
+
+ if service.errors.present?
+ output[:warnings] = push_options_warning(service.errors.join("\n\n"))
+ end
+
+ output
+ end
+
+ def push_options_warning(warning)
+ options = Array.wrap(params[:push_options]).map { |p| "'#{p}'" }.join(' ')
+ "Error encountered with push options #{options}: #{warning}"
+ end
+
def redis_ping
result = Gitlab::Redis::SharedState.with { |redis| redis.ping }