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
Jérome Perrin
gitlab-ce
Commits
90dd3fb3
Commit
90dd3fb3
authored
Aug 04, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a membership with no user is always notifiable
since this is for user invites and the like.
parent
0268fc2f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
app/models/member.rb
app/models/member.rb
+10
-2
app/models/members/group_member.rb
app/models/members/group_member.rb
+2
-2
app/models/members/project_member.rb
app/models/members/project_member.rb
+2
-2
No files found.
app/models/member.rb
View file @
90dd3fb3
...
@@ -276,6 +276,14 @@ class Member < ActiveRecord::Base
...
@@ -276,6 +276,14 @@ class Member < ActiveRecord::Base
@notification_setting
||=
user
.
notification_settings_for
(
source
)
@notification_setting
||=
user
.
notification_settings_for
(
source
)
end
end
def
notifiable?
(
type
,
opts
=
{})
# always notify when there isn't a user yet
return
true
if
user
.
blank?
NotificationRecipientService
.
notifiable?
(
user
,
type
,
notifiable_options
.
merge
(
opts
))
end
private
private
def
send_invite
def
send_invite
...
@@ -333,7 +341,7 @@ class Member < ActiveRecord::Base
...
@@ -333,7 +341,7 @@ class Member < ActiveRecord::Base
NotificationService
.
new
NotificationService
.
new
end
end
def
notifiable
?
(
type
,
opts
=
{})
def
notifiable
_options
raise
'abstract'
{}
end
end
end
end
app/models/members/group_member.rb
View file @
90dd3fb3
...
@@ -30,8 +30,8 @@ class GroupMember < Member
...
@@ -30,8 +30,8 @@ class GroupMember < Member
'Group'
'Group'
end
end
def
notifiable
?
(
type
,
opts
=
{})
def
notifiable
_options
NotificationRecipientService
.
notifiable?
(
user
,
type
,
{
group:
group
}.
merge
(
opts
))
{
group:
group
}
end
end
private
private
...
...
app/models/members/project_member.rb
View file @
90dd3fb3
...
@@ -87,8 +87,8 @@ class ProjectMember < Member
...
@@ -87,8 +87,8 @@ class ProjectMember < Member
project
.
owner
==
user
project
.
owner
==
user
end
end
def
notifiable
?
(
type
,
opts
=
{})
def
notifiable
_options
NotificationRecipientService
.
notifiable?
(
user
,
type
,
{
project:
project
}.
merge
(
opts
))
{
project:
project
}
end
end
private
private
...
...
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