diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-11 12:09:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-11 12:09:18 +0300 |
commit | 7240fb1a06c9e1b254719426b1ac96ec2f00fe35 (patch) | |
tree | a2c0e2b679bc34c9446a5e4653f5d63f2292205d /app/services/test_hooks | |
parent | 62d57690bc54e195b2544091725421144ce76900 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/test_hooks')
-rw-r--r-- | app/services/test_hooks/system_service.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/services/test_hooks/system_service.rb b/app/services/test_hooks/system_service.rb index 66d78bfc578..ddec45343e9 100644 --- a/app/services/test_hooks/system_service.rb +++ b/app/services/test_hooks/system_service.rb @@ -6,6 +6,10 @@ module TestHooks private + def use_newest_record? + Feature.enabled?(:integrations_test_webhook_reorder) + end + def data strong_memoize(:data) do case trigger @@ -20,7 +24,12 @@ module TestHooks end def merge_requests_events_data - merge_request = MergeRequest.of_projects(current_user.projects.select(:id)).first + merge_request = if use_newest_record? + MergeRequest.of_projects(current_user.projects.select(:id)).last + else + MergeRequest.of_projects(current_user.projects.select(:id)).first + end + return { error: s_('TestHooks|Ensure one of your projects has merge requests.') } unless merge_request.present? merge_request.to_hook_data(current_user) |