Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ff3a62aa
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,发现更多精彩内容 >>
提交
ff3a62aa
编写于
5月 09, 2015
作者:
R
Robert Speicher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove legacy special case for emphasized reference notes
上级
cdb69d72
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
49 deletion
+9
-49
app/services/system_note_service.rb
app/services/system_note_service.rb
+9
-13
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+0
-36
未找到文件。
app/services/system_note_service.rb
浏览文件 @
ff3a62aa
...
...
@@ -196,7 +196,7 @@ class SystemNoteService
end
gfm_reference
=
mentioner_gfm_ref
(
noteable
,
mentioner
,
true
)
notes
=
notes
.
where
(
'note like ?'
,
cross_reference_note_pattern
(
gfm_reference
))
notes
=
notes
.
where
(
note:
cross_reference_note_content
(
gfm_reference
))
notes
.
count
>
0
end
...
...
@@ -207,17 +207,14 @@ class SystemNoteService
Note
.
create
(
args
.
merge
(
system:
true
))
end
def
self
.
cross_reference_note_prefix
'mentioned in '
end
# Prepend the mentioner's namespaced project path to the GFM reference for
# cross-project references. For same-project references, return the
# unmodified GFM reference.
def
self
.
mentioner_gfm_ref
(
noteable
,
mentioner
,
cross_reference
=
false
)
if
mentioner
.
is_a?
(
Commit
)
&&
cross_reference
return
mentioner
.
gfm_reference
.
sub
(
'commit '
,
'commit %'
)
end
# FIXME (rspeicher): This was breaking things.
# if mentioner.is_a?(Commit) && cross_reference
# return mentioner.gfm_reference.sub('commit ', 'commit %')
# end
full_gfm_reference
(
mentioner
.
project
,
noteable
.
project
,
mentioner
)
end
...
...
@@ -243,13 +240,12 @@ class SystemNoteService
end
end
def
self
.
cross_reference_note_
content
(
gfm_reference
)
cross_reference_note_prefix
+
"
#{
gfm_reference
}
"
def
self
.
cross_reference_note_
prefix
'mentioned in '
end
def
self
.
cross_reference_note_pattern
(
gfm_reference
)
# Older cross reference notes contained underscores for emphasis
"%"
+
cross_reference_note_content
(
gfm_reference
)
+
"%"
def
self
.
cross_reference_note_content
(
gfm_reference
)
"
#{
cross_reference_note_prefix
}#{
gfm_reference
}
"
end
# Build an Array of lines detailing each commit added in a merge request
...
...
spec/services/system_note_service_spec.rb
浏览文件 @
ff3a62aa
...
...
@@ -313,41 +313,5 @@ describe SystemNoteService do
to
be_falsey
end
end
context
'legacy note with Markdown emphasis'
do
let
(
:mentioner
)
{
create
(
:issue
,
project:
project
)
}
before
do
note
=
"_mentioned in issue #
#{
mentioner
.
iid
}
_"
create
(
:system_note
,
noteable:
noteable
,
note:
note
,
project:
project
)
end
it
'detects if a mentionable with emphasis has been mentioned'
do
expect
(
described_class
.
cross_reference_exists?
(
noteable
,
mentioner
)).
to
be_truthy
end
context
'when referenced project has underscores'
do
let
(
:project
)
{
create
(
:empty_project
,
path:
'first_project'
)
}
let
(
:project2
)
{
create
(
:empty_project
,
path:
'second_project'
)
}
let
(
:issue
)
{
mentioner
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project2
)
}
before
do
described_class
.
cross_reference
(
issue
,
issue2
,
author
)
end
it
'is truthy when already mentioned'
do
expect
(
described_class
.
cross_reference_exists?
(
issue
,
issue2
)).
to
be_truthy
end
it
'is falsey when not already mentioned'
do
expect
(
described_class
.
cross_reference_exists?
(
issue2
,
issue
)).
to
be_falsey
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录