2013-03-19 14:00:41 -04:00
|
|
|
module Emails
|
|
|
|
module Projects
|
2014-09-15 03:57:02 -04:00
|
|
|
def project_access_granted_email(user_project_id)
|
|
|
|
@project_member = ProjectMember.find user_project_id
|
|
|
|
@project = @project_member.project
|
2014-02-18 05:12:01 -05:00
|
|
|
@target_url = project_url(@project)
|
2014-09-15 03:57:02 -04:00
|
|
|
mail(to: @project_member.user.email,
|
2013-11-08 10:04:36 -05:00
|
|
|
subject: subject("Access to project was granted"))
|
2013-03-19 14:00:41 -04:00
|
|
|
end
|
|
|
|
|
2013-06-22 03:56:51 -04:00
|
|
|
def project_was_moved_email(project_id, user_id)
|
|
|
|
@user = User.find user_id
|
|
|
|
@project = Project.find project_id
|
2014-02-18 05:12:01 -05:00
|
|
|
@target_url = project_url(@project)
|
2014-06-18 07:41:12 -04:00
|
|
|
mail(to: @user.email,
|
2013-11-08 10:04:36 -05:00
|
|
|
subject: subject("Project was moved"))
|
2013-03-19 14:00:41 -04:00
|
|
|
end
|
2013-12-17 07:45:55 -05:00
|
|
|
|
2013-12-17 09:20:45 -05:00
|
|
|
def repository_push_email(project_id, recipient, author_id, branch, compare)
|
|
|
|
@project = Project.find(project_id)
|
|
|
|
@author = User.find(author_id)
|
2014-02-12 05:56:13 -05:00
|
|
|
@compare = compare
|
2013-12-17 09:20:45 -05:00
|
|
|
@commits = Commit.decorate(compare.commits)
|
2013-12-17 07:45:55 -05:00
|
|
|
@diffs = compare.diffs
|
|
|
|
@branch = branch
|
2014-02-18 05:12:01 -05:00
|
|
|
if @commits.length > 1
|
|
|
|
@target_url = project_compare_url(@project, from: @commits.first, to: @commits.last)
|
2014-06-11 12:37:29 -04:00
|
|
|
@subject = "#{@commits.length} new commits pushed to repository"
|
2014-02-18 05:12:01 -05:00
|
|
|
else
|
2014-04-10 12:41:20 -04:00
|
|
|
@target_url = project_commit_url(@project, @commits.first)
|
2014-06-11 12:37:29 -04:00
|
|
|
@subject = @commits.first.title
|
2014-02-18 05:12:01 -05:00
|
|
|
end
|
2013-12-17 07:45:55 -05:00
|
|
|
|
2014-02-17 12:49:42 -05:00
|
|
|
mail(from: sender(author_id),
|
2014-06-18 07:41:12 -04:00
|
|
|
to: recipient,
|
2014-06-11 12:37:29 -04:00
|
|
|
subject: subject(@subject))
|
2013-12-17 07:45:55 -05:00
|
|
|
end
|
2013-03-19 14:00:41 -04:00
|
|
|
end
|
|
|
|
end
|