Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
bbca0351
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,发现更多精彩内容 >>
提交
bbca0351
编写于
3月 25, 2014
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6606 from kemenaran/fix-merge-notifications
Fix the merge notification email not being sent
上级
55be026e
65f5496e
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
30 addition
and
6 deletion
+30
-6
app/mailers/emails/merge_requests.rb
app/mailers/emails/merge_requests.rb
+2
-2
app/services/notification_service.rb
app/services/notification_service.rb
+1
-1
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+24
-0
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+3
-3
未找到文件。
app/mailers/emails/merge_requests.rb
浏览文件 @
bbca0351
...
...
@@ -29,11 +29,11 @@ module Emails
subject:
subject
(
"
#{
@merge_request
.
title
}
(!
#{
@merge_request
.
iid
}
)"
))
end
def
merged_merge_request_email
(
recipient_id
,
merge_request_id
)
def
merged_merge_request_email
(
recipient_id
,
merge_request_id
,
updated_by_user_id
)
@merge_request
=
MergeRequest
.
find
(
merge_request_id
)
@project
=
@merge_request
.
project
@target_url
=
project_merge_request_url
(
@project
,
@merge_request
)
mail
(
from:
sender
(
@merge_request
.
author_id_of_changes
),
mail
(
from:
sender
(
updated_by_user_id
),
to:
recipient
(
recipient_id
),
subject:
subject
(
"
#{
@merge_request
.
title
}
(!
#{
@merge_request
.
iid
}
)"
))
end
...
...
app/services/notification_service.rb
浏览文件 @
bbca0351
...
...
@@ -91,7 +91,7 @@ class NotificationService
recipients
=
recipients
.
concat
(
project_watchers
(
merge_request
.
target_project
)).
uniq
recipients
.
each
do
|
recipient
|
mailer
.
merged_merge_request_email
(
recipient
.
id
,
merge_request
.
id
)
mailer
.
merged_merge_request_email
(
recipient
.
id
,
merge_request
.
id
,
merge_request
.
author_id_of_changes
)
end
end
...
...
spec/mailers/notify_spec.rb
浏览文件 @
bbca0351
...
...
@@ -229,6 +229,7 @@ describe Notify do
end
context
'for merge requests'
do
let
(
:merge_author
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
author:
current_user
,
assignee:
assignee
,
source_project:
project
,
target_project:
project
)
}
let
(
:merge_request_with_description
)
{
create
(
:merge_request
,
author:
current_user
,
assignee:
assignee
,
source_project:
project
,
target_project:
project
,
description:
Faker
::
Lorem
.
sentence
)
}
...
...
@@ -288,7 +289,30 @@ describe Notify do
it
'contains a link to the merge request'
do
should
have_body_text
/
#{
project_merge_request_path
project
,
merge_request
}
/
end
end
describe
'that are merged'
do
subject
{
Notify
.
merged_merge_request_email
(
recipient
.
id
,
merge_request
.
id
,
merge_author
.
id
)
}
it_behaves_like
'a multiple recipients email'
it
'is sent as the merge author'
do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
.
display_name
.
should
eq
(
merge_author
.
name
)
sender
.
address
.
should
eq
(
gitlab_sender
)
end
it
'has the correct subject'
do
should
have_subject
/
#{
merge_request
.
title
}
\(!
#{
merge_request
.
iid
}
\)/
end
it
'contains the new status'
do
should
have_body_text
/merged/i
end
it
'contains a link to the merge request'
do
should
have_body_text
/
#{
project_merge_request_path
project
,
merge_request
}
/
end
end
end
end
...
...
spec/services/notification_service_spec.rb
浏览文件 @
bbca0351
...
...
@@ -233,15 +233,15 @@ describe NotificationService do
should_email
(
@u_watcher
.
id
)
should_not_email
(
@u_participating
.
id
)
should_not_email
(
@u_disabled
.
id
)
notification
.
merge_mr
(
merge_request
)
notification
.
merge_mr
(
merge_request
,
@u_disabled
)
end
def
should_email
(
user_id
)
Notify
.
should_receive
(
:merged_merge_request_email
).
with
(
user_id
,
merge_request
.
id
)
Notify
.
should_receive
(
:merged_merge_request_email
).
with
(
user_id
,
merge_request
.
id
,
@u_disabled
.
id
)
end
def
should_not_email
(
user_id
)
Notify
.
should_not_receive
(
:merged_merge_request_email
).
with
(
user_id
,
merge_request
.
id
)
Notify
.
should_not_receive
(
:merged_merge_request_email
).
with
(
user_id
,
merge_request
.
id
,
@u_disabled
.
id
)
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录