Commit 19309b97 authored by http://jneen.net/'s avatar http://jneen.net/

default the project to target.project

parent 3829d724
class NotificationRecipient
attr_reader :user, :project, :type
def initialize(user, project, type,
custom_action: nil, target: nil, acting_user: nil, read_ability: nil)
@project = project
def initialize(user, type,
custom_action: nil,
target: nil,
acting_user: nil,
read_ability: nil,
project: nil)
@custom_action = custom_action
@acting_user = acting_user
@read_ability = read_ability
@target = target
@project = project || @target&.project
@user = user
@type = type
raise ArgumentError, "Project is missing" if @project.nil?
end
def notification_setting
......
......@@ -56,7 +56,8 @@ module NotificationRecipientService
end
def make_recipient(user, type)
NotificationRecipient.new(user, project, type,
NotificationRecipient.new(user, type,
project: project,
custom_action: custom_action,
target: target,
acting_user: acting_user,
......
......@@ -272,7 +272,7 @@ class NotificationService
end
def project_was_moved(project, old_path_with_namespace)
recipients = NotificationRecipientService.notifiable_users(project.team.members, project, :mention)
recipients = NotificationRecipientService.notifiable_users(project.team.members, :mention, project: project)
recipients.each do |recipient|
mailer.project_was_moved_email(
......@@ -307,7 +307,7 @@ class NotificationService
return unless mailer.respond_to?(email_template)
recipients ||= NotificationRecipientService.notifiable_users(
[pipeline.user], pipeline.project, :watch,
[pipeline.user], :watch,
custom_action: :"#{pipeline.status}_pipeline",
read_ability: :read_build,
target: pipeline
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment