Commit 73446fe15e35c6e9d077b071bec7f06f64a1b6b9
1 parent
fc6ed495
Exists in
master
and in
4 other branches
Email templates when user was added to group
Showing
6 changed files
with
37 additions
and
13 deletions
Show diff stats
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +module Emails | ||
2 | + module Groups | ||
3 | + def group_access_granted_email(user_group_id) | ||
4 | + @membership = UsersGroup.find(user_group_id) | ||
5 | + @group = @membership.group | ||
6 | + | ||
7 | + mail(to: @membership.user.email, | ||
8 | + subject: subject("access to group was granted")) | ||
9 | + end | ||
10 | + end | ||
11 | +end |
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +module Emails | ||
2 | + module Profile | ||
3 | + def new_user_email(user_id, password) | ||
4 | + @user = User.find(user_id) | ||
5 | + @password = password | ||
6 | + mail(to: @user.email, subject: subject("Account was created for you")) | ||
7 | + end | ||
8 | + | ||
9 | + def new_ssh_key_email(key_id) | ||
10 | + @key = Key.find(key_id) | ||
11 | + @user = @key.user | ||
12 | + mail(to: @user.email, subject: subject("SSH key was added to your account")) | ||
13 | + end | ||
14 | + end | ||
15 | +end |
app/mailers/emails/projects.rb
@@ -7,7 +7,6 @@ module Emails | @@ -7,7 +7,6 @@ module Emails | ||
7 | subject: subject("access to project was granted")) | 7 | subject: subject("access to project was granted")) |
8 | end | 8 | end |
9 | 9 | ||
10 | - | ||
11 | def project_was_moved_email(project_id, user_id) | 10 | def project_was_moved_email(project_id, user_id) |
12 | @user = User.find user_id | 11 | @user = User.find user_id |
13 | @project = Project.find project_id | 12 | @project = Project.find project_id |
app/mailers/notify.rb
@@ -3,6 +3,8 @@ class Notify < ActionMailer::Base | @@ -3,6 +3,8 @@ class Notify < ActionMailer::Base | ||
3 | include Emails::MergeRequests | 3 | include Emails::MergeRequests |
4 | include Emails::Notes | 4 | include Emails::Notes |
5 | include Emails::Projects | 5 | include Emails::Projects |
6 | + include Emails::Profile | ||
7 | + include Emails::Groups | ||
6 | 8 | ||
7 | add_template_helper ApplicationHelper | 9 | add_template_helper ApplicationHelper |
8 | add_template_helper GitlabMarkdownHelper | 10 | add_template_helper GitlabMarkdownHelper |
@@ -20,18 +22,6 @@ class Notify < ActionMailer::Base | @@ -20,18 +22,6 @@ class Notify < ActionMailer::Base | ||
20 | delay_for(2.seconds) | 22 | delay_for(2.seconds) |
21 | end | 23 | end |
22 | 24 | ||
23 | - def new_user_email(user_id, password) | ||
24 | - @user = User.find(user_id) | ||
25 | - @password = password | ||
26 | - mail(to: @user.email, subject: subject("Account was created for you")) | ||
27 | - end | ||
28 | - | ||
29 | - def new_ssh_key_email(key_id) | ||
30 | - @key = Key.find(key_id) | ||
31 | - @user = @key.user | ||
32 | - mail(to: @user.email, subject: subject("SSH key was added to your account")) | ||
33 | - end | ||
34 | - | ||
35 | private | 25 | private |
36 | 26 | ||
37 | # Look up a User by their ID and return their email address | 27 | # Look up a User by their ID and return their email address |