Commit 539c70c7 authored by Izaak Alpert's avatar Izaak Alpert

Update emails to describe path using for_fork?

Forked MR's will print

Project:Branch <source_project_with_path>:<source_branch> -> <target_project_with_path>:<target_branch>

Non forked MR's will print

Branch <source_branch> -> <target_branch>

Change-Id: I89399aec2e7fde8e4b64b110a48099a95ae4f038
parent d9959427
......@@ -33,4 +33,12 @@ module MergeRequestsHelper
def ci_build_details_path merge_request
merge_request.source_project.gitlab_ci_service.build_page(merge_request.last_commit.sha)
end
def merge_path_description(merge_request, separator)
if merge_request.for_fork?
"Project:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} #{separator} #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}"
else
"Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}"
end
end
end
......@@ -23,7 +23,6 @@ module Emails
end
end
# Over rides default behavour to show source/target
# Formats arguments into a String suitable for use as an email subject
#
......@@ -63,4 +62,5 @@ module Emails
subject << " | " + extra.join(' | ') if extra.present?
subject
end
end
......@@ -6,6 +6,7 @@ class Notify < ActionMailer::Base
add_template_helper ApplicationHelper
add_template_helper GitlabMarkdownHelper
add_template_helper MergeRequestsHelper
default_url_options[:host] = Gitlab.config.gitlab.host
default_url_options[:protocol] = Gitlab.config.gitlab.protocol
......
%p
= "Merge Request #{@merge_request.id} was closed by #{@updated_by.name}"
%p
= link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.project, @merge_request)
= link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.target_project, @merge_request)
%p
Projects:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} &rarr; #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}
!= merge_path_description(@merge_request, '&rarr;')
%p
Assignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name}
......@@ -2,7 +2,7 @@
Merge Request url: #{project_merge_request_url(@merge_request.target_project, @merge_request)}
Project:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} to #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}
= merge_path_description(@merge_request, 'to')
Author: #{@merge_request.author_name}
Assignee: #{@merge_request.assignee_name}
......@@ -3,7 +3,7 @@
%p
= link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.target_project, @merge_request)
%p
Projects:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} &rarr; #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}
!= merge_path_description(@merge_request, '&rarr;')
%p
Assignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name}
......@@ -2,7 +2,7 @@
Merge Request Url: #{project_merge_request_url(@merge_request.target_project, @merge_request)}
Project:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} to #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}
= merge_path_description(@merge_request, 'to')
Author: #{@merge_request.author_name}
Assignee: #{@merge_request.assignee_name}
......@@ -3,7 +3,7 @@
%p
= link_to_gfm truncate(@merge_request.title, length: 40), project_merge_request_url(@merge_request.target_project, @merge_request)
%p
Project:Branches: #{@merge_request.source_project.path_with_namespace}:#{@merge_request.source_branch} &rarr; #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}
!= merge_path_description(@merge_request, '&rarr;')
%p
Assignee: #{@merge_request.author_name} &rarr; #{@merge_request.assignee_name}
......@@ -2,7 +2,7 @@ New Merge Request <%= @merge_request.id %>
<%= url_for(project_merge_request_url(@merge_request.target_project, @merge_request)) %>
From: <%= @merge_request.source_project.path_with_namespace%>:<%= @merge_request.source_branch %> to <%= @merge_request.target_project.path_with_namespace%>:<%= @merge_request.target_branch %>
<%= merge_path_description(@merge_request, 'to') %>
Author: <%= @merge_request.author_name %>
Asignee: <%= @merge_request.assignee_name %>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment