diff options
author | Toon Claes <toon@gitlab.com> | 2019-04-16 11:49:25 +0200 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2019-04-17 13:24:56 +0200 |
commit | f6417b82aad6b29b72dade9bdfcfd48e5857881d (patch) | |
tree | 47e5979492639b06087d9df07914cfdc7120d307 | |
parent | 38da5d6b23577edcd2a924125e0e4f3f8236f234 (diff) | |
download | gitlab-ce-f6417b82aad6b29b72dade9bdfcfd48e5857881d.tar.gz |
Include link to raw job log in plain-text emails
People who prefer plain text email also might prefer the raw job log
files. So include the link directly to there.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56849
-rw-r--r-- | app/views/notify/links/ci/builds/_build.text.erb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/tc-raw-log-in-plaintext-mail.yml | 5 | ||||
-rw-r--r-- | spec/views/notify/pipeline_failed_email.text.erb_spec.rb | 39 |
3 files changed, 45 insertions, 1 deletions
diff --git a/app/views/notify/links/ci/builds/_build.text.erb b/app/views/notify/links/ci/builds/_build.text.erb index 773ae8174e9..afb02f97e5a 100644 --- a/app/views/notify/links/ci/builds/_build.text.erb +++ b/app/views/notify/links/ci/builds/_build.text.erb @@ -1 +1 @@ -Job #<%= build.id %> ( <%= pipeline_job_url(pipeline, build) %> ) +Job #<%= build.id %> ( <%= raw_project_job_url(pipeline.project, build) %> ) diff --git a/changelogs/unreleased/tc-raw-log-in-plaintext-mail.yml b/changelogs/unreleased/tc-raw-log-in-plaintext-mail.yml new file mode 100644 index 00000000000..373c2847ef2 --- /dev/null +++ b/changelogs/unreleased/tc-raw-log-in-plaintext-mail.yml @@ -0,0 +1,5 @@ +--- +title: Include link to raw job log in plain-text emails +merge_request: 27409 +author: +type: changed diff --git a/spec/views/notify/pipeline_failed_email.text.erb_spec.rb b/spec/views/notify/pipeline_failed_email.text.erb_spec.rb new file mode 100644 index 00000000000..a7d3dc09fd4 --- /dev/null +++ b/spec/views/notify/pipeline_failed_email.text.erb_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true +require 'spec_helper' + +describe 'notify/pipeline_failed_email.text.erb' do + include Devise::Test::ControllerHelpers + + let(:user) { create(:user) } + let(:project) { create(:project, :repository) } + let(:merge_request) { create(:merge_request, :simple, source_project: project) } + + let(:pipeline) do + create(:ci_pipeline, + :failed, + project: project, + user: user, + ref: project.default_branch, + sha: project.commit.sha) + end + + before do + assign(:project, project) + assign(:pipeline, pipeline) + assign(:merge_request, merge_request) + end + + it 'renders the email correctly' do + job = create(:ci_build, :failed, pipeline: pipeline, project: pipeline.project) + + render + + expect(rendered).to have_content('Your pipeline has failed') + expect(rendered).to have_content(pipeline.project.name) + expect(rendered).to have_content(pipeline.git_commit_message.truncate(50)) + expect(rendered).to have_content(pipeline.commit.author_name) + expect(rendered).to have_content("##{pipeline.id}") + expect(rendered).to have_content(pipeline.user.name) + expect(rendered).to have_content("/-/jobs/#{job.id}/raw") + end +end |