gitlab-org--gitlab-foss/app/mailers/emails/projects.rb
Pierre de La Morinerie 466b768bb3 Send notification emails to the "project", and put people in Cc
This fixes email threading in Mail.app, that doesn't like when a thread
doesn't have stable recipients.

For instance, here is a possible sender-recipient combinations before:

From: A
To: Me
New issue

From: B
To: Me
Reply on new issue

From: A
To: Me
Another reply

Mail.app doesn't see B as a participant to the original email thread,
and decides to break the thread: it will group all messages from A
together, and separately all messages from B.

This commit makes the thread look like this:

From: A
To: gitlab/project
Cc: Me
New issue

From: B
To: gitlab/project
Cc: Me
Reply on new issue

From: A
To: gitlab/project
Cc: Me
Another reply

Mail.app sees a common recipient, and group the thread correctly.
2014-06-10 17:09:15 +02:00

37 lines
1.2 KiB
Ruby

module Emails
module Projects
def project_access_granted_email(user_project_id)
@users_project = UsersProject.find user_project_id
@project = @users_project.project
@target_url = project_url(@project)
mail(cc: @users_project.user.email,
subject: subject("Access to project was granted"))
end
def project_was_moved_email(project_id, user_id)
@user = User.find user_id
@project = Project.find project_id
@target_url = project_url(@project)
mail(cc: @user.email,
subject: subject("Project was moved"))
end
def repository_push_email(project_id, recipient, author_id, branch, compare)
@project = Project.find(project_id)
@author = User.find(author_id)
@compare = compare
@commits = Commit.decorate(compare.commits)
@diffs = compare.diffs
@branch = branch
if @commits.length > 1
@target_url = project_compare_url(@project, from: @commits.first, to: @commits.last)
else
@target_url = project_commit_url(@project, @commits.first)
end
mail(from: sender(author_id),
cc: recipient,
subject: subject("New push to repository"))
end
end
end