Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Baklanov <antonbaklanov@gmail.com>2015-12-19 22:04:40 +0300
committerAnton Baklanov <antonbaklanov@gmail.com>2016-01-19 21:18:39 +0300
commit84124380e815e549f50d82051b2b546c12d9a724 (patch)
tree9d95beb6c17bb77a78cb6f25d1efeaa92d17dd8d /app/mailers/emails
parent340df52bc7734ff76e75aae113313259e42680fb (diff)
Added X-GitLab-... headers to emails from CI and Email On Push services
Fixes #2098
Diffstat (limited to 'app/mailers/emails')
-rw-r--r--app/mailers/emails/builds.rb13
-rw-r--r--app/mailers/emails/projects.rb6
2 files changed, 18 insertions, 1 deletions
diff --git a/app/mailers/emails/builds.rb b/app/mailers/emails/builds.rb
index d58609a2de5..64c1ce8cfab 100644
--- a/app/mailers/emails/builds.rb
+++ b/app/mailers/emails/builds.rb
@@ -3,13 +3,26 @@ module Emails
def build_fail_email(build_id, to)
@build = Ci::Build.find(build_id)
@project = @build.project
+ add_project_headers
+ add_build_headers
+ headers['X-GitLab-Build-Status'] = "failed"
mail(to: to, subject: subject("Build failed for #{@project.name}", @build.short_sha))
end
def build_success_email(build_id, to)
@build = Ci::Build.find(build_id)
@project = @build.project
+ add_project_headers
+ add_build_headers
+ headers['X-GitLab-Build-Status'] = "success"
mail(to: to, subject: subject("Build success for #{@project.name}", @build.short_sha))
end
+
+ private
+ def add_build_headers
+ headers['X-GitLab-Build-Id'] = @build.id
+ headers['X-GitLab-Build-Ref'] = @build.ref
+ end
+
end
end
diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb
index b96418679bd..377c2999d6c 100644
--- a/app/mailers/emails/projects.rb
+++ b/app/mailers/emails/projects.rb
@@ -43,7 +43,7 @@ module Emails
@current_user = @created_by = User.find(created_by_id)
@access_level = access_level
@invite_email = invite_email
-
+
@target_url = namespace_project_url(@project.namespace, @project)
mail(to: @created_by.notification_email,
@@ -65,6 +65,10 @@ module Emails
# used in notify layout
@target_url = @message.target_url
+ @project = Project.find project_id
+
+ add_project_headers
+ headers['X-GitLab-Author'] = @message.author_username
mail(from: sender(@message.author_id, @message.send_from_committer_email?),
reply_to: @message.reply_to,