Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
9357585e
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,发现更多精彩内容 >>
提交
9357585e
编写于
8月 29, 2018
作者:
S
Sean McGivern
提交者:
Lin Jen-Shin
9月 17, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove EE-specific code from Mentionable
上级
896c89e7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
6 deletion
+23
-6
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+10
-3
app/models/concerns/mentionable/reference_regexes.rb
app/models/concerns/mentionable/reference_regexes.rb
+9
-3
app/models/epic.rb
app/models/epic.rb
+4
-0
未找到文件。
app/models/concerns/mentionable.rb
浏览文件 @
9357585e
...
...
@@ -61,7 +61,7 @@ module Mentionable
cache_key:
[
self
,
attr
],
author:
author
,
skip_project_check:
skip_project_check?
)
)
.
merge
(
mentionable_params
)
extractor
.
analyze
(
text
,
options
)
end
...
...
@@ -86,12 +86,11 @@ module Mentionable
return
[]
unless
matches_cross_reference_regex?
refs
=
all_references
(
current_user
)
refs
=
(
refs
.
issues
+
refs
.
merge_requests
+
refs
.
commits
)
# We're using this method instead of Array diffing because that requires
# both of the object's `hash` values to be the same, which may not be the
# case for otherwise identical Commit objects.
refs
.
reject
{
|
ref
|
ref
==
local_reference
}
extracted_mentionables
(
refs
)
.
reject
{
|
ref
|
ref
==
local_reference
}
end
# Uses regex to quickly determine if mentionables might be referenced
...
...
@@ -134,6 +133,10 @@ module Mentionable
private
def
extracted_mentionables
(
refs
)
refs
.
issues
+
refs
.
merge_requests
+
refs
.
commits
end
# Returns a Hash of changed mentionable fields
#
# Preference is given to the `changes` Hash, but falls back to
...
...
@@ -161,4 +164,8 @@ module Mentionable
def
skip_project_check?
false
end
def
mentionable_params
{}
end
end
app/models/concerns/mentionable/reference_regexes.rb
浏览文件 @
9357585e
...
...
@@ -5,13 +5,19 @@ module Mentionable
def
self
.
reference_pattern
(
link_patterns
,
issue_pattern
)
Regexp
.
union
(
link_patterns
,
issue_pattern
,
Commit
.
reference_pattern
,
MergeRequest
.
reference_pattern
)
*
other_patterns
)
end
def
self
.
other_patterns
[
Commit
.
reference_pattern
,
MergeRequest
.
reference_pattern
]
end
DEFAULT_PATTERN
=
begin
issue_pattern
=
Issue
.
reference_pattern
link_patterns
=
Regexp
.
union
([
Issue
,
Commit
,
MergeRequest
].
map
(
&
:link_reference_pattern
)
)
link_patterns
=
Regexp
.
union
([
Issue
,
Commit
,
MergeRequest
,
Epic
].
map
(
&
:link_reference_pattern
).
compact
)
reference_pattern
(
link_patterns
,
issue_pattern
)
end
...
...
app/models/epic.rb
浏览文件 @
9357585e
...
...
@@ -3,6 +3,10 @@
# Placeholder class for model that is implemented in EE
# It reserves '&' as a reference prefix, but the table does not exists in CE
class
Epic
<
ActiveRecord
::
Base
def
self
.
link_reference_pattern
nil
end
def
self
.
reference_prefix
'&'
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录