diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-10-31 16:37:41 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-10-31 16:37:41 +0000 |
commit | fc892db6f02c992bef32bf994a694efd5205f61b (patch) | |
tree | 2574042aa96bae018432848f0e2b7d9dfd618584 /app | |
parent | 96c9981140049e18779d78711e0abcd6a04411f9 (diff) | |
parent | 6d6767c20148204162308477d44cae27488cb11c (diff) | |
download | gitlab-ce-fc892db6f02c992bef32bf994a694efd5205f61b.tar.gz |
Merge branch '53335-cancel-job-redirects-to-job-page' into 'master'
Send continue parameter on for `cancel_path`
Closes #53335
See merge request gitlab-org/gitlab-ce!22712
Diffstat (limited to 'app')
-rw-r--r-- | app/serializers/job_entity.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/serializers/job_entity.rb b/app/serializers/job_entity.rb index 0b19cb16955..a0a66511b7b 100644 --- a/app/serializers/job_entity.rb +++ b/app/serializers/job_entity.rb @@ -9,7 +9,7 @@ class JobEntity < Grape::Entity expose :started?, as: :started expose :build_path do |build| - build.target_url || path_to(:namespace_project_job, build) + build_path(build) end expose :retry_path, if: -> (*) { retryable? } do |build| @@ -17,7 +17,11 @@ class JobEntity < Grape::Entity end expose :cancel_path, if: -> (*) { cancelable? } do |build| - path_to(:cancel_namespace_project_job, build) + path_to( + :cancel_namespace_project_job, + build, + { continue: { to: build_path(build) } } + ) end expose :play_path, if: -> (*) { playable? } do |build| @@ -60,8 +64,12 @@ class JobEntity < Grape::Entity build.detailed_status(request.current_user) end - def path_to(route, build) - send("#{route}_path", build.project.namespace, build.project, build) # rubocop:disable GitlabSecurity/PublicSend + def path_to(route, build, params = {}) + send("#{route}_path", build.project.namespace, build.project, build, params) # rubocop:disable GitlabSecurity/PublicSend + end + + def build_path(build) + build.target_url || path_to(:namespace_project_job, build) end def failed? |