summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-03-30 13:25:46 +0100
committerSean McGivern <sean@gitlab.com>2018-03-30 13:25:46 +0100
commit5ab75649f3ea00b64cb63e7e5283100c6b70cfb5 (patch)
treec301d3390f5f665640d8f8e931662b28c4242a30 /app
parent6412c4c54a7a824e108899a34b1ecec5cbdcec4b (diff)
downloadgitlab-ce-5ab75649f3ea00b64cb63e7e5283100c6b70cfb5.tar.gz
Only send issue due emails to participants and custom subscribers
Diffstat (limited to 'app')
-rw-r--r--app/models/notification_setting.rb3
-rw-r--r--app/services/notification_recipient_service.rb3
-rw-r--r--app/services/notification_service.rb3
-rw-r--r--app/views/notify/issue_due_email.html.haml2
4 files changed, 7 insertions, 4 deletions
diff --git a/app/models/notification_setting.rb b/app/models/notification_setting.rb
index f6d9b0215fc..9195408551f 100644
--- a/app/models/notification_setting.rb
+++ b/app/models/notification_setting.rb
@@ -47,7 +47,8 @@ class NotificationSetting < ActiveRecord::Base
].freeze
EXCLUDED_WATCHER_EVENTS = [
- :push_to_merge_request
+ :push_to_merge_request,
+ :issue_due
].push(*EXCLUDED_PARTICIPATING_EVENTS).freeze
def self.find_or_create_for(source)
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb
index c4da679defe..f5e140bccee 100644
--- a/app/services/notification_recipient_service.rb
+++ b/app/services/notification_recipient_service.rb
@@ -204,10 +204,11 @@ module NotificationRecipientService
attr_reader :action
attr_reader :previous_assignee
attr_reader :skip_current_user
- def initialize(target, current_user, action:, previous_assignee: nil, skip_current_user: true)
+ def initialize(target, current_user, action:, custom_action: nil, previous_assignee: nil, skip_current_user: true)
@target = target
@current_user = current_user
@action = action
+ @custom_action = custom_action
@previous_assignee = previous_assignee
@skip_current_user = skip_current_user
end
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb
index 7d3c2856e93..274161df946 100644
--- a/app/services/notification_service.rb
+++ b/app/services/notification_service.rb
@@ -377,7 +377,8 @@ class NotificationService
recipients = NotificationRecipientService.build_recipients(
issue,
issue.author,
- action: "due_date",
+ action: 'due',
+ custom_action: :issue_due,
skip_current_user: false
)
diff --git a/app/views/notify/issue_due_email.html.haml b/app/views/notify/issue_due_email.html.haml
index c552c612098..600e183cfdf 100644
--- a/app/views/notify/issue_due_email.html.haml
+++ b/app/views/notify/issue_due_email.html.haml
@@ -1,6 +1,6 @@
- if Gitlab::CurrentSettings.email_author_in_body
%p.details
- Issue created by #{link_to @issue.author_name, user_url(@issue.author)} is due:
+ #{link_to @issue.author_name, user_url(@issue.author)}'s issue is due soon.
- if @issue.assignees.any?
%p