Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1404aa86
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1404aa86
编写于
9月 14, 2016
作者:
L
Lin Jen-Shin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split notification integration into another branch
上级
9d9c2d31
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
10 addition
and
31 deletion
+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
未找到文件。
app/models/ci/pipeline.rb
浏览文件 @
1404aa86
...
...
@@ -62,10 +62,6 @@ module Ci
after_transition
do
|
pipeline
,
transition
|
pipeline
.
execute_hooks
unless
transition
.
loopback?
end
after_transition
any
=>
[
:success
,
:failed
]
do
|
pipeline
,
transition
|
SendPipelineNotificationService
.
new
(
pipeline
).
execute
end
end
# ref can't be HEAD or SHA, can only be branch/tag name
...
...
@@ -94,11 +90,6 @@ module Ci
project
.
id
end
# For now the only user who participants is the user who triggered
def
participants
(
current_user
=
nil
)
[
user
]
end
def
valid_commit_sha
if
self
.
sha
==
Gitlab
::
Git
::
BLANK_SHA
self
.
errors
.
add
(
:sha
,
" cant be 00000000 (branch removal)"
)
...
...
app/models/notification_setting.rb
浏览文件 @
1404aa86
...
...
@@ -32,9 +32,7 @@ class NotificationSetting < ActiveRecord::Base
:reopen_merge_request
,
:close_merge_request
,
:reassign_merge_request
,
:merge_merge_request
,
:failed_pipeline
,
:success_pipeline
:merge_merge_request
]
store
:events
,
accessors:
EMAIL_EVENTS
,
coder:
JSON
...
...
app/services/ci/send_pipeline_notification_service.rb
浏览文件 @
1404aa86
...
...
@@ -6,8 +6,14 @@ module Ci
@pipeline
=
new_pipeline
end
def
execute
(
recipients
=
nil
)
notification_service
.
pipeline_finished
(
pipeline
,
recipients
)
def
execute
(
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
app/services/notification_service.rb
浏览文件 @
1404aa86
...
...
@@ -311,22 +311,6 @@ class NotificationService
mailer
.
project_was_not_exported_email
(
current_user
,
project
,
errors
).
deliver_later
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
# Get project/group users with CUSTOM notification level
...
...
spec/services/ci/send_pipeline_notification_service_spec.rb
浏览文件 @
1404aa86
...
...
@@ -9,7 +9,7 @@ describe Ci::SendPipelineNotificationService, services: true do
shared_examples
'sending emails'
do
it
'sends an email to pipeline user'
do
perform_enqueued_jobs
do
subject
.
execute
subject
.
execute
([
user
.
email
])
end
email
=
ActionMailer
::
Base
.
deliveries
.
last
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录