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
Boxiang Sun
gitlab-ce
Commits
b188e1b9
Commit
b188e1b9
authored
Jul 20, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move notification_setting_for_user_project to a public class method
parent
80647364
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+13
-13
No files found.
app/services/notification_recipient_service.rb
View file @
b188e1b9
...
@@ -4,6 +4,18 @@
...
@@ -4,6 +4,18 @@
class
NotificationRecipientService
class
NotificationRecipientService
attr_reader
:project
attr_reader
:project
def
self
.
notification_setting_for_user_project
(
user
,
project
)
project_setting
=
user
.
notification_settings_for
(
project
)
return
project_setting
unless
project_setting
.
global?
group_setting
=
user
.
notification_settings_for
(
project
.
group
)
return
group_setting
unless
group_setting
.
global?
user
.
global_notification_setting
end
def
initialize
(
project
)
def
initialize
(
project
)
@project
=
project
@project
=
project
end
end
...
@@ -55,7 +67,7 @@ class NotificationRecipientService
...
@@ -55,7 +67,7 @@ class NotificationRecipientService
:success_pipeline
:success_pipeline
end
end
notification_setting
=
notification_setting_for_user_project
(
current_user
,
target
.
project
)
notification_setting
=
NotificationRecipientService
.
notification_setting_for_user_project
(
current_user
,
target
.
project
)
return
[]
if
notification_setting
.
mention?
||
notification_setting
.
disabled?
return
[]
if
notification_setting
.
mention?
||
notification_setting
.
disabled?
...
@@ -317,16 +329,4 @@ class NotificationRecipientService
...
@@ -317,16 +329,4 @@ class NotificationRecipientService
def
build_custom_key
(
action
,
object
)
def
build_custom_key
(
action
,
object
)
"
#{
action
}
_
#{
object
.
class
.
model_name
.
name
.
underscore
}
"
.
to_sym
"
#{
action
}
_
#{
object
.
class
.
model_name
.
name
.
underscore
}
"
.
to_sym
end
end
def
notification_setting_for_user_project
(
user
,
project
)
project_setting
=
user
.
notification_settings_for
(
project
)
return
project_setting
unless
project_setting
.
global?
group_setting
=
user
.
notification_settings_for
(
project
.
group
)
return
group_setting
unless
group_setting
.
global?
user
.
global_notification_setting
end
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