Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
717fa136
Commit
717fa136
authored
Apr 10, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add emails around invitation.
parent
39f389ae
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
4 deletions
+82
-4
app/mailers/emails/groups.rb
app/mailers/emails/groups.rb
+20
-1
app/mailers/emails/projects.rb
app/mailers/emails/projects.rb
+22
-3
app/models/members/group_member.rb
app/models/members/group_member.rb
+12
-0
app/models/members/project_member.rb
app/models/members/project_member.rb
+12
-0
app/services/notification_service.rb
app/services/notification_service.rb
+16
-0
No files found.
app/mailers/emails/groups.rb
View file @
717fa136
...
@@ -5,8 +5,27 @@ module Emails
...
@@ -5,8 +5,27 @@ module Emails
@group
=
@group_member
.
group
@group
=
@group_member
.
group
@target_url
=
group_url
(
@group
)
@target_url
=
group_url
(
@group
)
@current_user
=
@group_member
.
user
@current_user
=
@group_member
.
user
mail
(
to:
@group_member
.
user
.
email
,
mail
(
to:
@group_member
.
user
.
notification_
email
,
subject:
subject
(
"Access to group was granted"
))
subject:
subject
(
"Access to group was granted"
))
end
end
def
group_member_invited_email
(
group_member_id
,
token
)
@group_member
=
GroupMember
.
find
group_member_id
@group
=
@group_member
.
group
@token
=
token
@target_url
=
group_url
(
@group
)
mail
(
to:
@group_member
.
invite_email
,
subject:
"Invite to join group
#{
@group
.
name
}
"
)
end
def
group_invite_accepted_email
(
group_member_id
)
@group_member
=
GroupMember
.
find
group_member_id
return
if
@group_member
.
created_by
.
nil?
@group
=
@group_member
.
group
@target_url
=
group_url
(
@group
)
mail
(
to:
@group_member
.
created_by
.
notification_email
,
subject:
subject
(
"Invite accepted"
))
end
end
end
end
end
app/mailers/emails/projects.rb
View file @
717fa136
module
Emails
module
Emails
module
Projects
module
Projects
def
project_access_granted_email
(
user_project
_id
)
def
project_access_granted_email
(
project_member
_id
)
@project_member
=
ProjectMember
.
find
user_project
_id
@project_member
=
ProjectMember
.
find
project_member
_id
@project
=
@project_member
.
project
@project
=
@project_member
.
project
@target_url
=
namespace_project_url
(
@project
.
namespace
,
@project
)
@target_url
=
namespace_project_url
(
@project
.
namespace
,
@project
)
@current_user
=
@project_member
.
user
@current_user
=
@project_member
.
user
mail
(
to:
@project_member
.
user
.
email
,
mail
(
to:
@project_member
.
user
.
notification_
email
,
subject:
subject
(
"Access to project was granted"
))
subject:
subject
(
"Access to project was granted"
))
end
end
def
project_member_invited_email
(
project_member_id
,
token
)
@project_member
=
ProjectMember
.
find
project_member_id
@project
=
@project_member
.
project
@token
=
token
@target_url
=
namespace_project_url
(
@project
.
namespace
,
@project
)
mail
(
to:
@project_member
.
invite_email
,
subject:
"Invite to join project
#{
@project
.
name_with_namespace
}
"
)
end
def
project_invite_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
)
mail
(
to:
@project_member
.
created_by
.
notification_email
,
subject:
subject
(
"Invite accepted"
))
end
def
project_was_moved_email
(
project_id
,
user_id
)
def
project_was_moved_email
(
project_id
,
user_id
)
@current_user
=
@user
=
User
.
find
user_id
@current_user
=
@user
=
User
.
find
user_id
@project
=
Project
.
find
project_id
@project
=
Project
.
find
project_id
...
...
app/models/members/group_member.rb
View file @
717fa136
...
@@ -41,6 +41,12 @@ class GroupMember < Member
...
@@ -41,6 +41,12 @@ class GroupMember < Member
private
private
def
send_invite
notification_service
.
invite_group_member
(
self
,
@raw_invite_token
)
super
end
def
post_create_hook
def
post_create_hook
notification_service
.
new_group_member
(
self
)
notification_service
.
new_group_member
(
self
)
...
@@ -54,4 +60,10 @@ class GroupMember < Member
...
@@ -54,4 +60,10 @@ class GroupMember < Member
super
super
end
end
def
after_accept_invite
notification_service
.
accept_group_invite
(
self
)
super
end
end
end
app/models/members/project_member.rb
View file @
717fa136
...
@@ -116,6 +116,12 @@ class ProjectMember < Member
...
@@ -116,6 +116,12 @@ class ProjectMember < Member
private
private
def
send_invite
notification_service
.
invite_project_member
(
self
,
@raw_invite_token
)
super
end
def
post_create_hook
def
post_create_hook
unless
owner?
unless
owner?
event_service
.
join_project
(
self
.
project
,
self
.
user
)
event_service
.
join_project
(
self
.
project
,
self
.
user
)
...
@@ -139,6 +145,12 @@ class ProjectMember < Member
...
@@ -139,6 +145,12 @@ class ProjectMember < Member
super
super
end
end
def
after_accept_invite
notification_service
.
accept_project_invite
(
self
)
super
end
def
event_service
def
event_service
EventCreateService
.
new
EventCreateService
.
new
end
end
...
...
app/services/notification_service.rb
View file @
717fa136
...
@@ -165,6 +165,14 @@ class NotificationService
...
@@ -165,6 +165,14 @@ class NotificationService
end
end
end
end
def
invite_project_member
(
project_member
,
token
)
mailer
.
project_member_invited_email
(
project_member
.
id
,
token
)
end
def
accept_project_invite
(
project_member
)
mailer
.
project_invite_accepted_email
(
project_member
.
id
)
end
def
new_project_member
(
project_member
)
def
new_project_member
(
project_member
)
mailer
.
project_access_granted_email
(
project_member
.
id
)
mailer
.
project_access_granted_email
(
project_member
.
id
)
end
end
...
@@ -173,6 +181,14 @@ class NotificationService
...
@@ -173,6 +181,14 @@ class NotificationService
mailer
.
project_access_granted_email
(
project_member
.
id
)
mailer
.
project_access_granted_email
(
project_member
.
id
)
end
end
def
invite_group_member
(
group_member
,
token
)
mailer
.
group_member_invited_email
(
group_member
.
id
,
token
)
end
def
accept_group_invite
(
group_member
)
mailer
.
group_invite_accepted_email
(
group_member
.
id
)
end
def
new_group_member
(
group_member
)
def
new_group_member
(
group_member
)
mailer
.
group_access_granted_email
(
group_member
.
id
)
mailer
.
group_access_granted_email
(
group_member
.
id
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment