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
Jérome Perrin
gitlab-ce
Commits
1404aa86
Commit
1404aa86
authored
Sep 14, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split notification integration into another branch
parent
9d9c2d31
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
31 deletions
+10
-31
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+0
-9
app/models/notification_setting.rb
app/models/notification_setting.rb
+1
-3
app/services/ci/send_pipeline_notification_service.rb
app/services/ci/send_pipeline_notification_service.rb
+8
-2
app/services/notification_service.rb
app/services/notification_service.rb
+0
-16
spec/services/ci/send_pipeline_notification_service_spec.rb
spec/services/ci/send_pipeline_notification_service_spec.rb
+1
-1
No files found.
app/models/ci/pipeline.rb
View file @
1404aa86
...
@@ -62,10 +62,6 @@ module Ci
...
@@ -62,10 +62,6 @@ module Ci
after_transition
do
|
pipeline
,
transition
|
after_transition
do
|
pipeline
,
transition
|
pipeline
.
execute_hooks
unless
transition
.
loopback?
pipeline
.
execute_hooks
unless
transition
.
loopback?
end
end
after_transition
any
=>
[
:success
,
:failed
]
do
|
pipeline
,
transition
|
SendPipelineNotificationService
.
new
(
pipeline
).
execute
end
end
end
# ref can't be HEAD or SHA, can only be branch/tag name
# ref can't be HEAD or SHA, can only be branch/tag name
...
@@ -94,11 +90,6 @@ module Ci
...
@@ -94,11 +90,6 @@ module Ci
project
.
id
project
.
id
end
end
# For now the only user who participants is the user who triggered
def
participants
(
current_user
=
nil
)
[
user
]
end
def
valid_commit_sha
def
valid_commit_sha
if
self
.
sha
==
Gitlab
::
Git
::
BLANK_SHA
if
self
.
sha
==
Gitlab
::
Git
::
BLANK_SHA
self
.
errors
.
add
(
:sha
,
" cant be 00000000 (branch removal)"
)
self
.
errors
.
add
(
:sha
,
" cant be 00000000 (branch removal)"
)
...
...
app/models/notification_setting.rb
View file @
1404aa86
...
@@ -32,9 +32,7 @@ class NotificationSetting < ActiveRecord::Base
...
@@ -32,9 +32,7 @@ class NotificationSetting < ActiveRecord::Base
:reopen_merge_request
,
:reopen_merge_request
,
:close_merge_request
,
:close_merge_request
,
:reassign_merge_request
,
:reassign_merge_request
,
:merge_merge_request
,
:merge_merge_request
:failed_pipeline
,
:success_pipeline
]
]
store
:events
,
accessors:
EMAIL_EVENTS
,
coder:
JSON
store
:events
,
accessors:
EMAIL_EVENTS
,
coder:
JSON
...
...
app/services/ci/send_pipeline_notification_service.rb
View file @
1404aa86
...
@@ -6,8 +6,14 @@ module Ci
...
@@ -6,8 +6,14 @@ module Ci
@pipeline
=
new_pipeline
@pipeline
=
new_pipeline
end
end
def
execute
(
recipients
=
nil
)
def
execute
(
recipients
)
notification_service
.
pipeline_finished
(
pipeline
,
recipients
)
email_template
=
"pipeline_
#{
pipeline
.
status
}
_email"
return
unless
Notify
.
respond_to?
(
email_template
)
recipients
.
each
do
|
to
|
Notify
.
public_send
(
email_template
,
pipeline
,
to
).
deliver_later
end
end
end
end
end
end
end
app/services/notification_service.rb
View file @
1404aa86
...
@@ -311,22 +311,6 @@ class NotificationService
...
@@ -311,22 +311,6 @@ class NotificationService
mailer
.
project_was_not_exported_email
(
current_user
,
project
,
errors
).
deliver_later
mailer
.
project_was_not_exported_email
(
current_user
,
project
,
errors
).
deliver_later
end
end
def
pipeline_finished
(
pipeline
,
recipients
=
nil
)
email_template
=
"pipeline_
#{
pipeline
.
status
}
_email"
return
unless
mailer
.
respond_to?
(
email_template
)
recipients
||=
build_recipients
(
pipeline
,
pipeline
.
project
,
nil
,
# The acting user, who won't be added to recipients
action:
pipeline
.
status
)
recipients
.
each
do
|
to
|
mailer
.
public_send
(
email_template
,
pipeline
,
to
.
email
).
deliver_later
end
end
protected
protected
# Get project/group users with CUSTOM notification level
# Get project/group users with CUSTOM notification level
...
...
spec/services/ci/send_pipeline_notification_service_spec.rb
View file @
1404aa86
...
@@ -9,7 +9,7 @@ describe Ci::SendPipelineNotificationService, services: true do
...
@@ -9,7 +9,7 @@ describe Ci::SendPipelineNotificationService, services: true do
shared_examples
'sending emails'
do
shared_examples
'sending emails'
do
it
'sends an email to pipeline user'
do
it
'sends an email to pipeline user'
do
perform_enqueued_jobs
do
perform_enqueued_jobs
do
subject
.
execute
subject
.
execute
([
user
.
email
])
end
end
email
=
ActionMailer
::
Base
.
deliveries
.
last
email
=
ActionMailer
::
Base
.
deliveries
.
last
...
...
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