summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-11-21 20:58:35 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-11-21 20:59:03 +0800
commitbf8c7dc3b13ba3661e2c2d43fa107f6c3496b3b2 (patch)
treeea4b06a7d05f0353b3fea04127476c0a80fdb069
parentfa936c68083810043b8c84fcbcad9fb3ce717eb6 (diff)
downloadgitlab-ce-bf8c7dc3b13ba3661e2c2d43fa107f6c3496b3b2.tar.gz
Use has_trace? instead of case switch, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7617#note_18745170 https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7617#note_18745221
-rw-r--r--app/models/generic_commit_status.rb4
-rw-r--r--app/views/notify/pipeline_failed_email.html.haml5
-rw-r--r--app/views/notify/pipeline_failed_email.text.erb2
3 files changed, 7 insertions, 4 deletions
diff --git a/app/models/generic_commit_status.rb b/app/models/generic_commit_status.rb
index fa54e3540d0..6af8efab81b 100644
--- a/app/models/generic_commit_status.rb
+++ b/app/models/generic_commit_status.rb
@@ -12,4 +12,8 @@ class GenericCommitStatus < CommitStatus
def tags
[:external]
end
+
+ def has_trace?
+ false
+ end
end
diff --git a/app/views/notify/pipeline_failed_email.html.haml b/app/views/notify/pipeline_failed_email.html.haml
index a540a080768..72825e7a7e1 100644
--- a/app/views/notify/pipeline_failed_email.html.haml
+++ b/app/views/notify/pipeline_failed_email.html.haml
@@ -165,12 +165,11 @@
- when GenericCommitStatus
= build.name
%tr.build-log
- - case build
- - when Ci::Build
+ - if build.has_trace?
%td{colspan: "2", style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:0 0 15px;"}
%pre{style: "font-family:Monaco,'Lucida Console','Courier New',Courier,monospace;background-color:#fafafa;border-radius:3px;overflow:hidden;white-space:pre-wrap;word-break:break-all;font-size:13px;line-height:1.4;padding:12px;color:#333333;margin:0;"}
= build.trace_html(last_lines: 10).html_safe
- - when GenericCommitStatus
+ - else
%td{colspan: "2"}
%tr.footer
%td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;"}
diff --git a/app/views/notify/pipeline_failed_email.text.erb b/app/views/notify/pipeline_failed_email.text.erb
index 88473532482..d4c03c01bc7 100644
--- a/app/views/notify/pipeline_failed_email.text.erb
+++ b/app/views/notify/pipeline_failed_email.text.erb
@@ -22,7 +22,7 @@ Pipeline #<%= @pipeline.id %> ( <%= pipeline_url(@pipeline) %> ) had <%= failed.
Build #<%= build.id %><%= if build.kind_of?(Ci::Build) then " ( #{pipeline_build_url(@pipeline, build)} )" end %>
Stage: <%= build.stage %>
Name: <%= build.name %>
-<% if build.kind_of?(Ci::Build) -%>
+<% if build.has_trace? -%>
Trace: <%= build.trace_with_state(last_lines: 10)[:text] %>
<% end -%>