diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb index 07f5655b82634a8a4441e1378c014e44d4fbf49b..e1456158ff7c82505d565f84c68b8e27ab67e1c6 100644 --- a/app/services/notification_recipient_service.rb +++ b/app/services/notification_recipient_service.rb @@ -5,13 +5,13 @@ class NotificationRecipientService attr_reader :project def self.notification_setting_for_user_project(user, project) - project_setting = user.notification_settings_for(project) + project_setting = project && user.notification_settings_for(project) - return project_setting unless project_setting.global? + return project_setting unless project_setting.nil? || project_setting.global? - group_setting = user.notification_settings_for(project.group) + group_setting = project&.group && user.notification_settings_for(project.group) - return group_setting unless group_setting.global? + return group_setting unless group_setting.nil? || group_setting.global? user.global_notification_setting end