2013-03-19 18:00:41 +00:00
|
|
|
module Emails
|
|
|
|
module Projects
|
|
|
|
def project_access_granted_email(user_project_id)
|
|
|
|
@users_project = UsersProject.find user_project_id
|
|
|
|
@project = @users_project.project
|
2014-02-18 10:12:01 +00:00
|
|
|
@target_url = project_url(@project)
|
2013-03-19 18:00:41 +00:00
|
|
|
mail(to: @users_project.user.email,
|
2013-11-08 15:04:36 +00:00
|
|
|
subject: subject("Access to project was granted"))
|
2013-03-19 18:00:41 +00:00
|
|
|
end
|
|
|
|
|
2013-06-22 07:56:51 +00:00
|
|
|
def project_was_moved_email(project_id, user_id)
|
|
|
|
@user = User.find user_id
|
|
|
|
@project = Project.find project_id
|
2014-02-18 10:12:01 +00:00
|
|
|
@target_url = project_url(@project)
|
2013-06-22 07:56:51 +00:00
|
|
|
mail(to: @user.email,
|
2013-11-08 15:04:36 +00:00
|
|
|
subject: subject("Project was moved"))
|
2013-03-19 18:00:41 +00:00
|
|
|
end
|
2013-12-17 12:45:55 +00:00
|
|
|
|
2013-12-17 14:20:45 +00: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 10:56:13 +00:00
|
|
|
@compare = compare
|
2013-12-17 14:20:45 +00:00
|
|
|
@commits = Commit.decorate(compare.commits)
|
2013-12-17 12:45:55 +00:00
|
|
|
@diffs = compare.diffs
|
|
|
|
@branch = branch
|
2014-02-18 10:12:01 +00:00
|
|
|
if @commits.length > 1
|
|
|
|
@target_url = project_compare_url(@project, from: @commits.first, to: @commits.last)
|
|
|
|
else
|
|
|
|
@target_url = project_commit_url(@project, @compare.commit)
|
|
|
|
end
|
2013-12-17 12:45:55 +00:00
|
|
|
|
2014-02-17 17:49:42 +00:00
|
|
|
mail(from: sender(author_id),
|
|
|
|
to: recipient,
|
|
|
|
subject: subject("New push to repository"))
|
2013-12-17 12:45:55 +00:00
|
|
|
end
|
2013-03-19 18:00:41 +00:00
|
|
|
end
|
|
|
|
end
|