diff options
author | David Alexander <davidpaulalexander@gmail.com> | 2016-03-14 16:13:35 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-14 13:12:02 +0300 |
commit | 17c22156c5fa5663aae65178ed38cbeef9a80b7e (patch) | |
tree | 5bd90d34c7360c892f6ea57dd1d3e4a6350a51cd /app/mailers/emails | |
parent | 0c0ef7dfb6afb1695b62037fc0fa5aba6ce697d7 (diff) |
Initial implementation of user access request to projects
Diffstat (limited to 'app/mailers/emails')
-rw-r--r-- | app/mailers/emails/projects.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index fdf1e9f5afc..6662c407c2c 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -11,6 +11,48 @@ module Emails subject: subject("Access to project was granted")) end + def project_member_requested_access(project_member_id) + @project_member = ProjectMember.find project_member_id + @project = @project_member.project + @target_url = namespace_project_url(@project.namespace, @project) + + project_admins = ProjectMember.in_project(@project) + .where(access_level: [Gitlab::Access::OWNER, Gitlab::Access::MASTER]) + .pluck(:notification_email) + + project_admins.each do |address| + mail(to: address, + subject: subject("Request to join project: #{@project.name_with_namespace}")) + end + end + + def project_request_access_accepted_email(project_member_id) + @project_member = ProjectMember.find project_member_id + return if @project_member.created_by.nil? + + @project = @project_member.project + + @target_url = namespace_project_url(@project.namespace, @project) + @current_user = @project_member.created_by + + mail(to: @project_member.created_by.notification_email, + subject: subject('Request for access granted')) + end + + def project_request_access_declined_email(project_member_id) + @project_member = ProjectMember.find project_member_id + return if @project_member.created_by.nil? + + @project = @project_member.project + + @target_url = namespace_project_url(@project.namespace, @project) + @current_user = @project_member.created_by + + mail(to: @project_member.created_by.notification_email, + subject: subject('Request for access declined')) + end + + def project_member_invited_email(project_member_id, token) @project_member = ProjectMember.find project_member_id @project = @project_member.project |