| ... | @@ -108,7 +108,7 @@ class NotificationService |
... | @@ -108,7 +108,7 @@ class NotificationService |
|
|
# * users with custom level checked with "reassign issue"
|
|
# * users with custom level checked with "reassign issue"
|
|
|
#
|
|
#
|
|
|
def reassigned_issue(issue, current_user, previous_assignees = [])
|
|
def reassigned_issue(issue, current_user, previous_assignees = [])
|
|
|
recipients = NotificationRecipientService.build_recipients(
|
|
recipients = NotificationRecipients::BuildService.build_recipients(
|
|
|
issue,
|
|
issue,
|
|
|
current_user,
|
|
current_user,
|
|
|
action: "reassign",
|
|
action: "reassign",
|
| ... | @@ -161,7 +161,7 @@ class NotificationService |
... | @@ -161,7 +161,7 @@ class NotificationService |
|
|
def push_to_merge_request(merge_request, current_user, new_commits: [], existing_commits: [])
|
|
def push_to_merge_request(merge_request, current_user, new_commits: [], existing_commits: [])
|
|
|
new_commits = new_commits.map { |c| { short_id: c.short_id, title: c.title } }
|
|
new_commits = new_commits.map { |c| { short_id: c.short_id, title: c.title } }
|
|
|
existing_commits = existing_commits.map { |c| { short_id: c.short_id, title: c.title } }
|
|
existing_commits = existing_commits.map { |c| { short_id: c.short_id, title: c.title } }
|
|
|
recipients = NotificationRecipientService.build_recipients(merge_request, current_user, action: "push_to")
|
|
recipients = NotificationRecipients::BuildService.build_recipients(merge_request, current_user, action: "push_to")
|
|
|
|
|
|
|
|
recipients.each do |recipient|
|
|
recipients.each do |recipient|
|
|
|
mailer.send(:push_to_merge_request_email, recipient.user.id, merge_request.id, current_user.id, recipient.reason, new_commits: new_commits, existing_commits: existing_commits).deliver_later
|
|
mailer.send(:push_to_merge_request_email, recipient.user.id, merge_request.id, current_user.id, recipient.reason, new_commits: new_commits, existing_commits: existing_commits).deliver_later
|
| ... | @@ -197,7 +197,7 @@ class NotificationService |
... | @@ -197,7 +197,7 @@ class NotificationService |
|
|
# * users with custom level checked with "reassign merge request"
|
|
# * users with custom level checked with "reassign merge request"
|
|
|
#
|
|
#
|
|
|
def reassigned_merge_request(merge_request, current_user, previous_assignees = [])
|
|
def reassigned_merge_request(merge_request, current_user, previous_assignees = [])
|
|
|
recipients = NotificationRecipientService.build_recipients(
|
|
recipients = NotificationRecipients::BuildService.build_recipients(
|
|
|
merge_request,
|
|
merge_request,
|
|
|
current_user,
|
|
current_user,
|
|
|
action: "reassign",
|
|
action: "reassign",
|
| ... | @@ -260,7 +260,7 @@ class NotificationService |
... | @@ -260,7 +260,7 @@ class NotificationService |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def resolve_all_discussions(merge_request, current_user)
|
|
def resolve_all_discussions(merge_request, current_user)
|
|
|
recipients = NotificationRecipientService.build_recipients(
|
|
recipients = NotificationRecipients::BuildService.build_recipients(
|
|
|
merge_request,
|
|
merge_request,
|
|
|
current_user,
|
|
current_user,
|
|
|
action: "resolve_all_discussions")
|
|
action: "resolve_all_discussions")
|
| ... | @@ -291,7 +291,7 @@ class NotificationService |
... | @@ -291,7 +291,7 @@ class NotificationService |
|
|
def send_new_note_notifications(note)
|
|
def send_new_note_notifications(note)
|
|
|
notify_method = "note_#{note.noteable_ability_name}_email".to_sym
|
|
notify_method = "note_#{note.noteable_ability_name}_email".to_sym
|
|
|
|
|
|
|
|
recipients = NotificationRecipientService.build_new_note_recipients(note)
|
|
recipients = NotificationRecipients::BuildService.build_new_note_recipients(note)
|
|
|
recipients.each do |recipient|
|
|
recipients.each do |recipient|
|
|
|
mailer.send(notify_method, recipient.user.id, note.id, recipient.reason).deliver_later
|
|
mailer.send(notify_method, recipient.user.id, note.id, recipient.reason).deliver_later
|
|
|
end
|
|
end
|
| ... | @@ -299,7 +299,7 @@ class NotificationService |
... | @@ -299,7 +299,7 @@ class NotificationService |
|
|
|
|
|
|
|
# Notify users when a new release is created
|
|
# Notify users when a new release is created
|
|
|
def send_new_release_notifications(release)
|
|
def send_new_release_notifications(release)
|
|
|
recipients = NotificationRecipientService.build_new_release_recipients(release)
|
|
recipients = NotificationRecipients::BuildService.build_new_release_recipients(release)
|
|
|
|
|
|
|
|
recipients.each do |recipient|
|
|
recipients.each do |recipient|
|
|
|
mailer.new_release_email(recipient.user.id, release, recipient.reason).deliver_later
|
|
mailer.new_release_email(recipient.user.id, release, recipient.reason).deliver_later
|
| ... | @@ -413,7 +413,7 @@ class NotificationService |
... | @@ -413,7 +413,7 @@ class NotificationService |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def issue_moved(issue, new_issue, current_user)
|
|
def issue_moved(issue, new_issue, current_user)
|
|
|
recipients = NotificationRecipientService.build_recipients(issue, current_user, action: 'moved')
|
|
recipients = NotificationRecipients::BuildService.build_recipients(issue, current_user, action: 'moved')
|
|
|
|
|
|
|
|
recipients.map do |recipient|
|
|
recipients.map do |recipient|
|
|
|
email = mailer.issue_moved_email(recipient.user, issue, new_issue, current_user, recipient.reason)
|
|
email = mailer.issue_moved_email(recipient.user, issue, new_issue, current_user, recipient.reason)
|
| ... | @@ -490,7 +490,7 @@ class NotificationService |
... | @@ -490,7 +490,7 @@ class NotificationService |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def issue_due(issue)
|
|
def issue_due(issue)
|
|
|
recipients = NotificationRecipientService.build_recipients(
|
|
recipients = NotificationRecipients::BuildService.build_recipients(
|
|
|
issue,
|
|
issue,
|
|
|
issue.author,
|
|
issue.author,
|
|
|
action: 'due',
|
|
action: 'due',
|
| ... | @@ -526,7 +526,7 @@ class NotificationService |
... | @@ -526,7 +526,7 @@ class NotificationService |
|
|
protected
|
|
protected
|
|
|
|
|
|
|
|
def new_resource_email(target, method)
|
|
def new_resource_email(target, method)
|
|
|
recipients = NotificationRecipientService.build_recipients(target, target.author, action: "new")
|
|
recipients = NotificationRecipients::BuildService.build_recipients(target, target.author, action: "new")
|
|
|
|
|
|
|
|
recipients.each do |recipient|
|
|
recipients.each do |recipient|
|
|
|
mailer.send(method, recipient.user.id, target.id, recipient.reason).deliver_later
|
|
mailer.send(method, recipient.user.id, target.id, recipient.reason).deliver_later
|
| ... | @@ -534,7 +534,7 @@ class NotificationService |
... | @@ -534,7 +534,7 @@ class NotificationService |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def new_mentions_in_resource_email(target, new_mentioned_users, current_user, method)
|
|
def new_mentions_in_resource_email(target, new_mentioned_users, current_user, method)
|
|
|
recipients = NotificationRecipientService.build_recipients(target, current_user, action: "new")
|
|
recipients = NotificationRecipients::BuildService.build_recipients(target, current_user, action: "new")
|
|
|
recipients = recipients.select {|r| new_mentioned_users.include?(r.user) }
|
|
recipients = recipients.select {|r| new_mentioned_users.include?(r.user) }
|
|
|
|
|
|
|
|
recipients.each do |recipient|
|
|
recipients.each do |recipient|
|
| ... | @@ -545,7 +545,7 @@ class NotificationService |
... | @@ -545,7 +545,7 @@ class NotificationService |
|
|
def close_resource_email(target, current_user, method, skip_current_user: true, closed_via: nil)
|
|
def close_resource_email(target, current_user, method, skip_current_user: true, closed_via: nil)
|
|
|
action = method == :merged_merge_request_email ? "merge" : "close"
|
|
action = method == :merged_merge_request_email ? "merge" : "close"
|
|
|
|
|
|
|
|
recipients = NotificationRecipientService.build_recipients(
|
|
recipients = NotificationRecipients::BuildService.build_recipients(
|
|
|
target,
|
|
target,
|
|
|
current_user,
|
|
current_user,
|
|
|
action: action,
|
|
action: action,
|
| ... | @@ -573,7 +573,7 @@ class NotificationService |
... | @@ -573,7 +573,7 @@ class NotificationService |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def removed_milestone_resource_email(target, current_user, method)
|
|
def removed_milestone_resource_email(target, current_user, method)
|
|
|
recipients = NotificationRecipientService.build_recipients(
|
|
recipients = NotificationRecipients::BuildService.build_recipients(
|
|
|
target,
|
|
target,
|
|
|
current_user,
|
|
current_user,
|
|
|
action: 'removed_milestone'
|
|
action: 'removed_milestone'
|
| ... | @@ -585,7 +585,7 @@ class NotificationService |
... | @@ -585,7 +585,7 @@ class NotificationService |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def changed_milestone_resource_email(target, milestone, current_user, method)
|
|
def changed_milestone_resource_email(target, milestone, current_user, method)
|
|
|
recipients = NotificationRecipientService.build_recipients(
|
|
recipients = NotificationRecipients::BuildService.build_recipients(
|
|
|
target,
|
|
target,
|
|
|
current_user,
|
|
current_user,
|
|
|
action: 'changed_milestone'
|
|
action: 'changed_milestone'
|
| ... | @@ -597,7 +597,7 @@ class NotificationService |
... | @@ -597,7 +597,7 @@ class NotificationService |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def reopen_resource_email(target, current_user, method, status)
|
|
def reopen_resource_email(target, current_user, method, status)
|
|
|
recipients = NotificationRecipientService.build_recipients(target, current_user, action: "reopen")
|
|
recipients = NotificationRecipients::BuildService.build_recipients(target, current_user, action: "reopen")
|
|
|
|
|
|
|
|
recipients.each do |recipient|
|
|
recipients.each do |recipient|
|
|
|
mailer.send(method, recipient.user.id, target.id, status, current_user.id, recipient.reason).deliver_later
|
|
mailer.send(method, recipient.user.id, target.id, status, current_user.id, recipient.reason).deliver_later
|
| ... | @@ -605,7 +605,7 @@ class NotificationService |
... | @@ -605,7 +605,7 @@ class NotificationService |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def merge_request_unmergeable_email(merge_request)
|
|
def merge_request_unmergeable_email(merge_request)
|
|
|
recipients = NotificationRecipientService.build_merge_request_unmergeable_recipients(merge_request)
|
|
recipients = NotificationRecipients::BuildService.build_merge_request_unmergeable_recipients(merge_request)
|
|
|
|
|
|
|
|
recipients.each do |recipient|
|
|
recipients.each do |recipient|
|
|
|
mailer.merge_request_unmergeable_email(recipient.user.id, merge_request.id).deliver_later
|
|
mailer.merge_request_unmergeable_email(recipient.user.id, merge_request.id).deliver_later
|
| ... | @@ -619,15 +619,15 @@ class NotificationService |
... | @@ -619,15 +619,15 @@ class NotificationService |
|
|
private
|
|
private
|
|
|
|
|
|
|
|
def project_maintainers_recipients(target, action:)
|
|
def project_maintainers_recipients(target, action:)
|
|
|
NotificationRecipientService.build_project_maintainers_recipients(target, action: action)
|
|
NotificationRecipients::BuildService.build_project_maintainers_recipients(target, action: action)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def notifiable?(*args)
|
|
def notifiable?(*args)
|
|
|
NotificationRecipientService.notifiable?(*args)
|
|
NotificationRecipients::BuildService.notifiable?(*args)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def notifiable_users(*args)
|
|
def notifiable_users(*args)
|
|
|
NotificationRecipientService.notifiable_users(*args)
|
|
NotificationRecipients::BuildService.notifiable_users(*args)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def deliver_access_request_email(recipient, member)
|
|
def deliver_access_request_email(recipient, member)
|
| ... | |
... | |
| ... | | ... | |