diff options
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/notification_recipient_service.rb | 10 | ||||
-rw-r--r-- | app/services/notification_service.rb | 13 |
2 files changed, 21 insertions, 2 deletions
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb index e4be953e810..c7c64356e30 100644 --- a/app/services/notification_recipient_service.rb +++ b/app/services/notification_recipient_service.rb @@ -230,14 +230,20 @@ module NotificationRecipientService add_subscribed_users - if [:new_issue, :new_merge_request].include?(custom_action) + if [:new_issue, :new_merge_request, :due_date_issue].include?(custom_action) # These will all be participants as well, but adding with the :mention # type ensures that users with the mention notification level will # receive them, too. add_mentions(current_user, target: target) # Add the assigned users, if any - assignees = custom_action == :new_issue ? target.assignees : target.assignee + assignees = case custom_action + when :new_issue, :due_date_issue + target.assignees + else + target.assignee + end + # We use the `:participating` notification level in order to match existing legacy behavior as captured # in existing specs (notification_service_spec.rb ~ line 507) add_recipients(assignees, :participating, NotificationReason::ASSIGNED) if assignees diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index d7d2cde1004..aade82f5cf1 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -363,6 +363,19 @@ class NotificationService end end + def issue_due_email(issue) + recipients = NotificationRecipientService.build_recipients( + issue, + issue.author, + action: "due_date", + skip_current_user: false, + ) + + recipients.each do |recipient| + mailer.send(:issue_due_email, recipient.user.id, issue.id, recipient.reason).deliver_later + end + end + protected def new_resource_email(target, method) |