diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-06-02 21:32:37 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-06-03 14:58:31 +0300 |
commit | a29ba51eeac6c7281b2fe81e655be946842045c0 (patch) | |
tree | e87950450aeea6ecc41b754f2c7ea638e4d2dc3d /app/serializers | |
parent | b2f997e40520d9a4996f00f1c3ef5b9a8f1c7f80 (diff) |
Fix test failures
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/build_details_entity.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb index bd7ceceb2fa..0063920e603 100644 --- a/app/serializers/build_details_entity.rb +++ b/app/serializers/build_details_entity.rb @@ -23,10 +23,8 @@ class BuildDetailsEntity < BuildEntity end end - expose :build_failed_options do - expose :new_issue_path, if: -> (*) { can?(request.current_user, :create_issue, project) } do |build| - new_namespace_project_issue_path(project.namespace, project) - end + expose :new_issue_path, if: -> (*) { can?(request.current_user, :create_issue, project) && build.failed? } do |build| + new_namespace_project_issue_path(project.namespace, project, issue: build_failed_issue_options) end expose :raw_path do |build| @@ -35,6 +33,13 @@ class BuildDetailsEntity < BuildEntity private + def build_failed_issue_options + { + title: "Build Failed ##{build.id}", + description: namespace_project_job_url(project.namespace, project, build) + } + end + def current_user request.current_user end |