Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
5f839770
Commit
5f839770
authored
Apr 24, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Rename namespace_regex to namespace_path_regex."
This reverts commit
c0116926
.
parent
70f9893e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+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
No files found.
app/models/namespace.rb
View file @
5f839770
...
...
@@ -33,8 +33,8 @@ class Namespace < ActiveRecord::Base
presence:
true
,
length:
{
within:
1
..
255
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
format:
{
with:
Gitlab
::
Regex
.
namespace_
path_
regex
,
message:
Gitlab
::
Regex
.
namespace_
path_
regex_message
}
format:
{
with:
Gitlab
::
Regex
.
namespace_regex
,
message:
Gitlab
::
Regex
.
namespace_regex_message
}
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
...
...
app/models/user.rb
View file @
5f839770
...
...
@@ -131,8 +131,8 @@ class User < ActiveRecord::Base
presence:
true
,
uniqueness:
{
case_sensitive:
false
},
exclusion:
{
in:
Gitlab
::
Blacklist
.
path
},
format:
{
with:
Gitlab
::
Regex
.
namespace_
path_
regex
,
message:
Gitlab
::
Regex
.
namespace_
path_
regex_message
}
format:
{
with:
Gitlab
::
Regex
.
namespace_regex
,
message:
Gitlab
::
Regex
.
namespace_regex_message
}
validates
:notification_level
,
inclusion:
{
in:
Notification
.
notification_levels
},
presence:
true
validate
:namespace_uniq
,
if:
->
(
user
)
{
user
.
username_changed?
}
...
...
lib/gitlab/markdown/cross_project_reference.rb
View file @
5f839770
...
...
@@ -3,7 +3,7 @@ module Gitlab
# Common methods for ReferenceFilters that support an optional cross-project
# reference.
module
CrossProjectReference
NAMING_PATTERN
=
Gitlab
::
Regex
::
NAMESPACE_
PATH_
REGEX_STR
NAMING_PATTERN
=
Gitlab
::
Regex
::
NAMESPACE_REGEX_STR
PROJECT_PATTERN
=
"(?<project>
#{
NAMING_PATTERN
}
/
#{
NAMING_PATTERN
}
)"
# Given a cross-project reference string, get the Project record
...
...
lib/gitlab/markdown/user_reference_filter.rb
View file @
5f839770
...
...
@@ -22,7 +22,7 @@ module Gitlab
end
# 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
replace_text_nodes_matching
(
USER_PATTERN
)
do
|
content
|
...
...
lib/gitlab/reference_extractor.rb
View file @
5f839770
...
...
@@ -85,7 +85,7 @@ module Gitlab
private
NAME_STR
=
Gitlab
::
Regex
::
NAMESPACE_
PATH_
REGEX_STR
NAME_STR
=
Gitlab
::
Regex
::
NAMESPACE_REGEX_STR
PROJ_STR
=
"(?<project>
#{
NAME_STR
}
/
#{
NAME_STR
}
)"
REFERENCE_PATTERN
=
%r{
...
...
lib/gitlab/regex.rb
View file @
5f839770
...
...
@@ -2,13 +2,13 @@ module Gitlab
module
Regex
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
@namespace_
path_regex
||=
/\A
#{
NAMESPACE_PATH
_REGEX_STR
}
\z/
.
freeze
def
namespace_regex
@namespace_
regex
||=
/\A
#{
NAMESPACE
_REGEX_STR
}
\z/
.
freeze
end
def
namespace_
path_
regex_message
def
namespace_regex_message
"can contain only letters, digits, '_', '-' and '.'. "
\
"Cannot start with '-' or end in '.'."
\
end
...
...
spec/requests/api/users_spec.rb
View file @
5f839770
...
...
@@ -145,7 +145,7 @@ describe API::API, api: true do
expect
(
json_response
[
'message'
][
'projects_limit'
]).
to
eq
([
'must be greater than or equal to 0'
])
expect
(
json_response
[
'message'
][
'username'
]).
to
eq
([
Gitlab
::
Regex
.
send
(
:namespace_
path_
regex_message
)])
to
eq
([
Gitlab
::
Regex
.
send
(
:namespace_regex_message
)])
end
it
"shouldn't available for non admin users"
do
...
...
@@ -271,7 +271,7 @@ describe API::API, api: true do
expect
(
json_response
[
'message'
][
'projects_limit'
]).
to
eq
([
'must be greater than or equal to 0'
])
expect
(
json_response
[
'message'
][
'username'
]).
to
eq
([
Gitlab
::
Regex
.
send
(
:namespace_
path_
regex_message
)])
to
eq
([
Gitlab
::
Regex
.
send
(
:namespace_regex_message
)])
end
context
"with existing user"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment