diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 03:07:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-05 03:07:49 +0300 |
commit | 77237c5a6b9044f58beabc54d3589e5fa09cbfba (patch) | |
tree | f43188047fe8955f6cf78e05ae9c2e8f6a019e0b /app/services/post_receive_service.rb | |
parent | 2fd92f2dc784ade9cb4e1c33dd60cbfad7b86818 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/post_receive_service.rb')
-rw-r--r-- | app/services/post_receive_service.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/services/post_receive_service.rb b/app/services/post_receive_service.rb index bc5ec22e77f..f12e45d701a 100644 --- a/app/services/post_receive_service.rb +++ b/app/services/post_receive_service.rb @@ -4,10 +4,11 @@ # # Used for scheduling related jobs after a push action has been performed class PostReceiveService - attr_reader :user, :project, :params + attr_reader :user, :repository, :project, :params - def initialize(user, project, params) + def initialize(user, repository, project, params) @user = user + @repository = repository @project = project @params = params end @@ -24,7 +25,7 @@ class PostReceiveService mr_options = push_options.get(:merge_request) if mr_options.present? - message = process_mr_push_options(mr_options, project, user, params[:changes]) + message = process_mr_push_options(mr_options, params[:changes]) response.add_alert_message(message) end @@ -46,8 +47,13 @@ class PostReceiveService response end - def process_mr_push_options(push_options, project, user, changes) + def process_mr_push_options(push_options, changes) Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/61359') + return unless repository + + unless repository.repo_type.project? + return push_options_warning('Push options are only supported for projects') + end service = ::MergeRequests::PushOptionsHandlerService.new( project, user, changes, push_options @@ -64,6 +70,8 @@ class PostReceiveService end def merge_request_urls + return [] unless repository&.repo_type&.project? + ::MergeRequests::GetUrlsService.new(project).execute(params[:changes]) end end |