Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0698113c
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,发现更多精彩内容 >>
未验证
提交
0698113c
编写于
5月 18, 2016
作者:
R
Rémy Coutable
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move #create_confidentiality_note to Issues::UpdateService
Signed-off-by:
N
Rémy Coutable
<
remy@rymai.me
>
上级
483c034b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
32 deletion
+19
-32
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+0
-6
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+7
-1
app/services/system_note_service.rb
app/services/system_note_service.rb
+7
-12
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+2
-2
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+3
-11
未找到文件。
app/services/issuable_base_service.rb
浏览文件 @
0698113c
...
...
@@ -36,12 +36,6 @@ class IssuableBaseService < BaseService
end
end
def
create_confidentiality_note
(
issuable
)
SystemNoteService
.
change_confidentiality
(
issuable
,
issuable
.
project
,
current_user
)
end
def
filter_params
(
issuable_ability_name
=
:issue
)
filter_assignee
filter_milestone
...
...
app/services/issues/update_service.rb
浏览文件 @
0698113c
...
...
@@ -10,7 +10,7 @@ module Issues
end
if
issue
.
previous_changes
.
include?
(
'title'
)
||
issue
.
previous_changes
.
include?
(
'description'
)
issue
.
previous_changes
.
include?
(
'description'
)
todo_service
.
update_issue
(
issue
,
current_user
)
end
...
...
@@ -41,5 +41,11 @@ module Issues
def
close_service
Issues
::
CloseService
end
private
def
create_confidentiality_note
(
issue
)
SystemNoteService
.
change_issue_confidentiality
(
issue
,
issue
.
project
,
current_user
)
end
end
end
app/services/system_note_service.rb
浏览文件 @
0698113c
...
...
@@ -169,29 +169,24 @@ class SystemNoteService
#
# Returns the created Note object
def
self
.
change_title
(
noteable
,
project
,
author
,
old_title
)
return
unless
noteable
.
respond_to?
(
:title
)
body
=
"Title changed from **
#{
old_title
}
** to **
#{
noteable
.
title
}
**"
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
# Called when the confidentiality changes
#
#
noteable - Noteable object that responds to 'confidential'
# project
- Project owning noteabl
e
# author
- User performing the change
#
issue - Issue object
# project
- Project owning the issu
e
# author - User performing the change
#
# Example Note text:
#
# "Ma
rked as
confidential"
# "Ma
de the issue
confidential"
#
# Returns the created Note object
def
self
.
change_confidentiality
(
noteable
,
project
,
author
)
return
unless
noteable
.
respond_to?
(
:confidential
)
confidentiality_status
=
noteable
.
confidential
?
"confidential"
:
"not confidential"
body
=
"Marked as
#{
confidentiality_status
}
"
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
def
self
.
change_issue_confidentiality
(
issue
,
project
,
author
)
body
=
issue
.
confidential
?
'Made the issue confidential'
:
'Made the issue visible'
create_note
(
noteable:
issue
,
project:
project
,
author:
author
,
note:
body
)
end
# Called when a branch in Noteable is changed
...
...
spec/services/issues/update_service_spec.rb
浏览文件 @
0698113c
...
...
@@ -82,10 +82,10 @@ describe Issues::UpdateService, services: true do
end
it
'creates system note about confidentiality change'
do
note
=
find_note
(
'Ma
rked as
confidential'
)
note
=
find_note
(
'Ma
de the issue
confidential'
)
expect
(
note
).
not_to
be_nil
expect
(
note
.
note
).
to
eq
'Ma
rked as
confidential'
expect
(
note
.
note
).
to
eq
'Ma
de the issue
confidential'
end
end
...
...
spec/services/system_note_service_spec.rb
浏览文件 @
0698113c
...
...
@@ -244,24 +244,16 @@ describe SystemNoteService, services: true do
to
eq
"Title changed from **Old title** to **
#{
noteable
.
title
}
**"
end
end
context
'when noteable does not respond to `title'
do
let
(
:noteable
)
{
double
(
'noteable'
)
}
it
'returns nil'
do
expect
(
subject
).
to
be_nil
end
end
end
describe
'.change_confidentiality'
do
subject
{
described_class
.
change_confidentiality
(
noteable
,
project
,
author
)
}
describe
'.change_
issue_
confidentiality'
do
subject
{
described_class
.
change_
issue_
confidentiality
(
noteable
,
project
,
author
)
}
context
'when noteable responds to `confidential`'
do
it_behaves_like
'a system note'
it
'sets the note text'
do
expect
(
subject
.
note
).
to
eq
"Marked as not confidential"
expect
(
subject
.
note
).
to
eq
'Made the issue visible'
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录