summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-07-20 11:57:42 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2017-08-03 09:06:15 -0700
commitb188e1b9e66eb02ac9b51364dfa33e206ea636c3 (patch)
treee8b38600f9ff6562db53d22791a10f7e74c460ec /app
parent80647364ffaad3d100c64dd8a1ab32e8a9b4bcf9 (diff)
downloadgitlab-ce-b188e1b9e66eb02ac9b51364dfa33e206ea636c3.tar.gz
move notification_setting_for_user_project to a public class method
Diffstat (limited to 'app')
-rw-r--r--app/services/notification_recipient_service.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb
index 1abf0335dc4..07f5655b826 100644
--- a/app/services/notification_recipient_service.rb
+++ b/app/services/notification_recipient_service.rb
@@ -4,6 +4,18 @@
class NotificationRecipientService
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)
@project = project
end
@@ -55,7 +67,7 @@ class NotificationRecipientService
:success_pipeline
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?
@@ -317,16 +329,4 @@ class NotificationRecipientService
def build_custom_key(action, object)
"#{action}_#{object.class.model_name.name.underscore}".to_sym
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