Skip to content
Snippets Groups Projects
Verified Commit 8dcc8e5d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix routing in CI mailer

parent 82b6a17c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -11,7 +11,7 @@ module Ci
def to_s
lines = Array.new
lines.push("<a href=\"#{ci_project_url(project)}\">#{project.name}</a> - ")
lines.push("<a href=\"#{ci_project_commits_url(project, commit.sha)}\">Commit ##{commit.id}</a></br>")
lines.push("<a href=\"#{ci_namespace_project_commit_url(commit.gl_project.namespace, commit.gl_project, commit.sha)}\">Commit ##{commit.id}</a></br>")
lines.push("#{commit.short_sha} #{commit.git_author_name} - #{commit.git_commit_message}</br>")
lines.push("#{humanized_status(commit_status)} in #{commit.duration} second(s).")
lines.join('')
Loading
Loading
Loading
Loading
@@ -28,7 +28,7 @@ module Ci
next unless build.failed?
fields << {
title: build.name,
value: "Build <#{ci_project_build_url(project, build)}|\##{build.id}> failed in #{build.duration.to_i} second(s)."
value: "Build <#{namespace_project_build_url(build.gl_project.namespace, build.gl_project, build)}|\##{build.id}> failed in #{build.duration.to_i} second(s)."
}
end
 
Loading
Loading
@@ -45,7 +45,7 @@ module Ci
 
def attachment_message
out = "<#{ci_project_url(project)}|#{project_name}>: "
out << "Commit <#{ci_project_commits_url(project, commit.sha)}|\##{commit.id}> "
out << "Commit <#{ci_namespace_project_commit_url(commit.gl_project.namespace, commit.gl_project, commit.sha)}|\##{commit.id}> "
out << "(<#{commit_sha_link}|#{commit.short_sha}>) "
out << "of <#{commit_ref_link}|#{commit.ref}> "
out << "by #{commit.git_author_name} " if commit.git_author_name
Loading
Loading
Loading
Loading
@@ -71,7 +71,7 @@ class GitlabCiService < CiService
 
def build_page(sha, ref)
if project.gitlab_ci_project.present?
ci_project_commits_url(project.gitlab_ci_project, sha)
ci_namespace_project_commit_url(project.namespace, project, sha)
end
end
 
Loading
Loading
Loading
Loading
@@ -16,4 +16,4 @@
Message: #{@build.commit.git_commit_message}
 
%p
Url: #{link_to @build.short_sha, ci_project_build_url(@project, @build)}
Url: #{link_to @build.short_sha, namespace_project_build_url(@build.gl_project.namespace, @build.gl_project, @build)}
Loading
Loading
@@ -6,4 +6,4 @@ Author: <%= @build.commit.git_author_name %>
Branch: <%= @build.ref %>
Message: <%= @build.commit.git_commit_message %>
 
Url: <%= ci_project_build_url(@build.project, @build) %>
Url: <%= namespace_project_build_url(@build.gl_project.namespace, @build.gl_project, @build) %>
Loading
Loading
@@ -17,4 +17,4 @@
Message: #{@build.commit.git_commit_message}
 
%p
Url: #{link_to @build.short_sha, ci_project_build_url(@project, @build)}
Url: #{link_to @build.short_sha, namespace_project_build_url(@build.gl_project.namespace, @build.gl_project, @build)}
Loading
Loading
@@ -6,4 +6,4 @@ Author: <%= @build.commit.git_author_name %>
Branch: <%= @build.ref %>
Message: <%= @build.commit.git_commit_message %>
 
Url: <%= ci_project_build_url(@build.project, @build) %>
Url: <%= namespace_project_build_url(@build.gl_project.namespace, @build.gl_project, @build) %>
Loading
Loading
@@ -39,8 +39,7 @@ describe GitlabCiService do
end
 
describe :build_page do
it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://localhost/ci/projects/#{@ci_project.id}/commits/2ab7834c")}
it { expect(@service.build_page("issue#2", 'master')).to eq("http://localhost/ci/projects/#{@ci_project.id}/commits/issue%232")}
it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://localhost/#{@ci_project.gl_project.path_with_namespace}/commit/2ab7834c/ci")}
end
 
describe "execute" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment