Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
5ab75649
Commit
5ab75649
authored
Mar 30, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only send issue due emails to participants and custom subscribers
parent
6412c4c5
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
39 additions
and
15 deletions
+39
-15
app/models/notification_setting.rb
app/models/notification_setting.rb
+2
-1
app/services/notification_recipient_service.rb
app/services/notification_recipient_service.rb
+2
-1
app/services/notification_service.rb
app/services/notification_service.rb
+2
-1
app/views/notify/issue_due_email.html.haml
app/views/notify/issue_due_email.html.haml
+1
-1
db/migrate/20180330121048_add_issue_due_to_notification_settings.rb
.../20180330121048_add_issue_due_to_notification_settings.rb
+9
-0
db/schema.rb
db/schema.rb
+2
-1
doc/api/notification_settings.md
doc/api/notification_settings.md
+4
-0
doc/workflow/notifications.md
doc/workflow/notifications.md
+7
-7
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+10
-3
No files found.
app/models/notification_setting.rb
View file @
5ab75649
...
...
@@ -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
)
...
...
app/services/notification_recipient_service.rb
View file @
5ab75649
...
...
@@ -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
...
...
app/services/notification_service.rb
View file @
5ab75649
...
...
@@ -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
)
...
...
app/views/notify/issue_due_email.html.haml
View file @
5ab75649
-
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
...
...
db/migrate/20180330121048_add_issue_due_to_notification_settings.rb
0 → 100644
View file @
5ab75649
class
AddIssueDueToNotificationSettings
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:notification_settings
,
:issue_due
,
:boolean
end
end
db/schema.rb
View file @
5ab75649
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201803
27101207
)
do
ActiveRecord
::
Schema
.
define
(
version:
201803
30121048
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -1311,6 +1311,7 @@ ActiveRecord::Schema.define(version: 20180327101207) do
t
.
boolean
"failed_pipeline"
t
.
boolean
"success_pipeline"
t
.
boolean
"push_to_merge_request"
t
.
boolean
"issue_due"
end
add_index
"notification_settings"
,
[
"source_id"
,
"source_type"
],
name:
"index_notification_settings_on_source_id_and_source_type"
,
using: :btree
...
...
doc/api/notification_settings.md
View file @
5ab75649
...
...
@@ -23,6 +23,7 @@ new_issue
reopen_issue
close_issue
reassign_issue
issue_due
new_merge_request
push_to_merge_request
reopen_merge_request
...
...
@@ -75,6 +76,7 @@ curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab
|
`reopen_issue`
| boolean | no | Enable/disable this notification |
|
`close_issue`
| boolean | no | Enable/disable this notification |
|
`reassign_issue`
| boolean | no | Enable/disable this notification |
|
`issue_due`
| boolean | no | Enable/disable this notification |
|
`new_merge_request`
| boolean | no | Enable/disable this notification |
|
`push_to_merge_request`
| boolean | no | Enable/disable this notification |
|
`reopen_merge_request`
| boolean | no | Enable/disable this notification |
...
...
@@ -142,6 +144,7 @@ curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab
|
`reopen_issue`
| boolean | no | Enable/disable this notification |
|
`close_issue`
| boolean | no | Enable/disable this notification |
|
`reassign_issue`
| boolean | no | Enable/disable this notification |
|
`issue_due`
| boolean | no | Enable/disable this notification |
|
`new_merge_request`
| boolean | no | Enable/disable this notification |
|
`push_to_merge_request`
| boolean | no | Enable/disable this notification |
|
`reopen_merge_request`
| boolean | no | Enable/disable this notification |
...
...
@@ -166,6 +169,7 @@ Example responses:
"reopen_issue"
:
false
,
"close_issue"
:
false
,
"reassign_issue"
:
false
,
"issue_due"
:
false
,
"new_merge_request"
:
false
,
"push_to_merge_request"
:
false
,
"reopen_merge_request"
:
false
,
...
...
doc/workflow/notifications.md
View file @
5ab75649
...
...
@@ -86,6 +86,7 @@ In most of the below cases, the notification will be sent to:
| Close issue | |
| Reassign issue | The above, plus the old assignee |
| Reopen issue | |
| Due issue | Participants and Custom notification level with this event selected |
| New merge request | |
| Push to merge request | Participants and Custom notification level with this event selected |
| Reassign merge request | The above, plus the old assignee |
...
...
@@ -96,15 +97,14 @@ In most of the below cases, the notification will be sent to:
| Failed pipeline | The author of the pipeline |
| Successful pipeline | The author of the pipeline, if they have the custom notification setting for successful pipelines set |
In addition, if the title or description of an Issue or Merge Request is
changed, notifications will be sent to any
**new**
mentions by
`@username`
as
if they had been mentioned in the original text.
You won't receive notifications for Issues, Merge Requests or Milestones
created by yourself. You will only receive automatic notifications when
somebody else comments or adds changes to the ones that you've created or
mentions you.
You won't receive notifications for Issues, Merge Requests or Milestones
created
by yourself (except when an issue is due). You will only receive automatic
notifications when somebody else comments or adds changes to the ones that
you've created or
mentions you.
### Email Headers
...
...
spec/services/notification_service_spec.rb
View file @
5ab75649
...
...
@@ -935,16 +935,23 @@ describe NotificationService, :mailer do
end
describe
'#issue_due'
do
it
'sends email to issue notification recipients'
do
before
do
update_custom_notification
(
:issue_due
,
@u_guest_custom
,
resource:
project
)
update_custom_notification
(
:issue_due
,
@u_custom_global
)
end
it
'sends email to issue notification recipients, excluding watchers'
do
notification
.
issue_due
(
issue
)
should_email
(
issue
.
assignees
.
first
)
should_email
(
issue
.
author
)
should_email
(
@u_
watcher
)
should_email
(
@u_
guest_watcher
)
should_email
(
@u_
guest_custom
)
should_email
(
@u_
custom_global
)
should_email
(
@u_participant_mentioned
)
should_email
(
@subscriber
)
should_email
(
@watcher_and_subscriber
)
should_not_email
(
@u_watcher
)
should_not_email
(
@u_guest_watcher
)
should_not_email
(
@unsubscriber
)
should_not_email
(
@u_participating
)
should_not_email
(
@u_disabled
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment