Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
5f839770
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,发现更多精彩内容 >>
提交
5f839770
编写于
4月 24, 2015
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Rename namespace_regex to namespace_path_regex."
This reverts commit
c0116926
.
上级
70f9893e
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
13 addition
and
13 deletion
+13
-13
app/models/namespace.rb
app/models/namespace.rb
+2
-2
app/models/user.rb
app/models/user.rb
+2
-2
lib/gitlab/markdown/cross_project_reference.rb
lib/gitlab/markdown/cross_project_reference.rb
+1
-1
lib/gitlab/markdown/user_reference_filter.rb
lib/gitlab/markdown/user_reference_filter.rb
+1
-1
lib/gitlab/reference_extractor.rb
lib/gitlab/reference_extractor.rb
+1
-1
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+4
-4
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+2
-2
未找到文件。
app/models/namespace.rb
浏览文件 @
5f839770
...
@@ -33,8 +33,8 @@ class Namespace < ActiveRecord::Base
...
@@ -33,8 +33,8 @@ class Namespace < ActiveRecord::Base
presence:
true
,
presence:
true
,
length:
{
within:
1
..
255
},
length:
{
within:
1
..
255
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
format:
{
with:
Gitlab
::
Regex
.
namespace_
path_
regex
,
format:
{
with:
Gitlab
::
Regex
.
namespace_regex
,
message:
Gitlab
::
Regex
.
namespace_
path_
regex_message
}
message:
Gitlab
::
Regex
.
namespace_regex_message
}
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
...
...
app/models/user.rb
浏览文件 @
5f839770
...
@@ -131,8 +131,8 @@ class User < ActiveRecord::Base
...
@@ -131,8 +131,8 @@ class User < ActiveRecord::Base
presence:
true
,
presence:
true
,
uniqueness:
{
case_sensitive:
false
},
uniqueness:
{
case_sensitive:
false
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
format:
{
with:
Gitlab
::
Regex
.
namespace_
path_
regex
,
format:
{
with:
Gitlab
::
Regex
.
namespace_regex
,
message:
Gitlab
::
Regex
.
namespace_
path_
regex_message
}
message:
Gitlab
::
Regex
.
namespace_regex_message
}
validates
:notification_level
,
inclusion:
{
in:
Notification
.
notification_levels
},
presence:
true
validates
:notification_level
,
inclusion:
{
in:
Notification
.
notification_levels
},
presence:
true
validate
:namespace_uniq
,
if:
->
(
user
)
{
user
.
username_changed?
}
validate
:namespace_uniq
,
if:
->
(
user
)
{
user
.
username_changed?
}
...
...
lib/gitlab/markdown/cross_project_reference.rb
浏览文件 @
5f839770
...
@@ -3,7 +3,7 @@ module Gitlab
...
@@ -3,7 +3,7 @@ module Gitlab
# Common methods for ReferenceFilters that support an optional cross-project
# Common methods for ReferenceFilters that support an optional cross-project
# reference.
# reference.
module
CrossProjectReference
module
CrossProjectReference
NAMING_PATTERN
=
Gitlab
::
Regex
::
NAMESPACE_
PATH_
REGEX_STR
NAMING_PATTERN
=
Gitlab
::
Regex
::
NAMESPACE_REGEX_STR
PROJECT_PATTERN
=
"(?<project>
#{
NAMING_PATTERN
}
/
#{
NAMING_PATTERN
}
)"
PROJECT_PATTERN
=
"(?<project>
#{
NAMING_PATTERN
}
/
#{
NAMING_PATTERN
}
)"
# Given a cross-project reference string, get the Project record
# Given a cross-project reference string, get the Project record
...
...
lib/gitlab/markdown/user_reference_filter.rb
浏览文件 @
5f839770
...
@@ -22,7 +22,7 @@ module Gitlab
...
@@ -22,7 +22,7 @@ module Gitlab
end
end
# Pattern used to extract `@user` user references from text
# Pattern used to extract `@user` user references from text
USER_PATTERN
=
/@(?<user>
#{
Gitlab
::
Regex
::
NAMESPACE_
PATH_
REGEX_STR
}
)/
USER_PATTERN
=
/@(?<user>
#{
Gitlab
::
Regex
::
NAMESPACE_REGEX_STR
}
)/
def
call
def
call
replace_text_nodes_matching
(
USER_PATTERN
)
do
|
content
|
replace_text_nodes_matching
(
USER_PATTERN
)
do
|
content
|
...
...
lib/gitlab/reference_extractor.rb
浏览文件 @
5f839770
...
@@ -85,7 +85,7 @@ module Gitlab
...
@@ -85,7 +85,7 @@ module Gitlab
private
private
NAME_STR
=
Gitlab
::
Regex
::
NAMESPACE_
PATH_
REGEX_STR
NAME_STR
=
Gitlab
::
Regex
::
NAMESPACE_REGEX_STR
PROJ_STR
=
"(?<project>
#{
NAME_STR
}
/
#{
NAME_STR
}
)"
PROJ_STR
=
"(?<project>
#{
NAME_STR
}
/
#{
NAME_STR
}
)"
REFERENCE_PATTERN
=
%r{
REFERENCE_PATTERN
=
%r{
...
...
lib/gitlab/regex.rb
浏览文件 @
5f839770
...
@@ -2,13 +2,13 @@ module Gitlab
...
@@ -2,13 +2,13 @@ module Gitlab
module
Regex
module
Regex
extend
self
extend
self
NAMESPACE_
PATH_
REGEX_STR
=
'(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'
.
freeze
NAMESPACE_REGEX_STR
=
'(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'
.
freeze
def
namespace_
path_
regex
def
namespace_regex
@namespace_
path_regex
||=
/\A
#{
NAMESPACE_PATH
_REGEX_STR
}
\z/
.
freeze
@namespace_
regex
||=
/\A
#{
NAMESPACE
_REGEX_STR
}
\z/
.
freeze
end
end
def
namespace_
path_
regex_message
def
namespace_regex_message
"can contain only letters, digits, '_', '-' and '.'. "
\
"can contain only letters, digits, '_', '-' and '.'. "
\
"Cannot start with '-' or end in '.'."
\
"Cannot start with '-' or end in '.'."
\
end
end
...
...
spec/requests/api/users_spec.rb
浏览文件 @
5f839770
...
@@ -145,7 +145,7 @@ describe API::API, api: true do
...
@@ -145,7 +145,7 @@ describe API::API, api: true do
expect
(
json_response
[
'message'
][
'projects_limit'
]).
expect
(
json_response
[
'message'
][
'projects_limit'
]).
to
eq
([
'must be greater than or equal to 0'
])
to
eq
([
'must be greater than or equal to 0'
])
expect
(
json_response
[
'message'
][
'username'
]).
expect
(
json_response
[
'message'
][
'username'
]).
to
eq
([
Gitlab
::
Regex
.
send
(
:namespace_
path_
regex_message
)])
to
eq
([
Gitlab
::
Regex
.
send
(
:namespace_regex_message
)])
end
end
it
"shouldn't available for non admin users"
do
it
"shouldn't available for non admin users"
do
...
@@ -271,7 +271,7 @@ describe API::API, api: true do
...
@@ -271,7 +271,7 @@ describe API::API, api: true do
expect
(
json_response
[
'message'
][
'projects_limit'
]).
expect
(
json_response
[
'message'
][
'projects_limit'
]).
to
eq
([
'must be greater than or equal to 0'
])
to
eq
([
'must be greater than or equal to 0'
])
expect
(
json_response
[
'message'
][
'username'
]).
expect
(
json_response
[
'message'
][
'username'
]).
to
eq
([
Gitlab
::
Regex
.
send
(
:namespace_
path_
regex_message
)])
to
eq
([
Gitlab
::
Regex
.
send
(
:namespace_regex_message
)])
end
end
context
"with existing user"
do
context
"with existing user"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录