Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-09-06 15:13:33 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2018-09-06 15:13:33 +0300
commit4a14ff5bcefe170d3f3ff9885fff21500442fac6 (patch)
tree9ba4d8995333b3839cd1f8c3950dfe408c544d79 /app
parent0bbea6da1886b61f8612c2c38fd1c08e1632073e (diff)
parent26f577df8023c1efa1ae776bb976f38ab0de4a3f (diff)
Merge branch '51117-send-terminal-path-in-job-api' into 'master'
Add terminal path to job API response Closes #51117 See merge request gitlab-org/gitlab-ce!21537
Diffstat (limited to 'app')
-rw-r--r--app/serializers/build_details_entity.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb
index 271ff668eda..b107fc26f18 100644
--- a/app/serializers/build_details_entity.rb
+++ b/app/serializers/build_details_entity.rb
@@ -36,6 +36,10 @@ class BuildDetailsEntity < JobEntity
erase_project_job_path(project, build)
end
+ expose :terminal_path, if: -> (*) { can_create_build_terminal? } do |build|
+ terminal_project_job_path(project, build)
+ end
+
expose :merge_request, if: -> (*) { can?(current_user, :read_merge_request, build.merge_request) } do
expose :iid do |build|
build.merge_request.iid
@@ -69,4 +73,8 @@ class BuildDetailsEntity < JobEntity
def project
build.project
end
+
+ def can_create_build_terminal?
+ can?(current_user, :create_build_terminal, build) && build.has_terminal?
+ end
end