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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
08d21fe8
Commit
08d21fe8
authored
Nov 08, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add small improvements to constrainers and specs
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
82e551bd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
4 deletions
+4
-4
lib/constraints/group_url_constrainer.rb
lib/constraints/group_url_constrainer.rb
+1
-1
lib/constraints/user_url_constrainer.rb
lib/constraints/user_url_constrainer.rb
+1
-1
spec/lib/constraints/group_url_constrainer_spec.rb
spec/lib/constraints/group_url_constrainer_spec.rb
+1
-1
spec/lib/constraints/user_url_constrainer_spec.rb
spec/lib/constraints/user_url_constrainer_spec.rb
+1
-1
No files found.
lib/constraints/group_url_constrainer.rb
View file @
08d21fe8
...
@@ -7,7 +7,7 @@ class GroupUrlConstrainer
...
@@ -7,7 +7,7 @@ class GroupUrlConstrainer
id
=
extract_resource_path
(
request
.
path
)
id
=
extract_resource_path
(
request
.
path
)
if
id
=~
Gitlab
::
Regex
.
namespace_regex
if
id
=~
Gitlab
::
Regex
.
namespace_regex
!!
Group
.
find_by_path
(
id
)
Group
.
find_by
(
path:
id
).
present?
else
else
false
false
end
end
...
...
lib/constraints/user_url_constrainer.rb
View file @
08d21fe8
...
@@ -7,7 +7,7 @@ class UserUrlConstrainer
...
@@ -7,7 +7,7 @@ class UserUrlConstrainer
id
=
extract_resource_path
(
request
.
path
)
id
=
extract_resource_path
(
request
.
path
)
if
id
=~
Gitlab
::
Regex
.
namespace_regex
if
id
=~
Gitlab
::
Regex
.
namespace_regex
!!
User
.
find_by
(
'lower(username) = ?'
,
id
.
downcase
)
User
.
find_by
(
'lower(username) = ?'
,
id
.
downcase
).
present?
else
else
false
false
end
end
...
...
spec/lib/constraints/group_url_constrainer_spec.rb
View file @
08d21fe8
...
@@ -14,6 +14,6 @@ describe GroupUrlConstrainer, lib: true do
...
@@ -14,6 +14,6 @@ describe GroupUrlConstrainer, lib: true do
end
end
def
request
(
path
)
def
request
(
path
)
OpenStruct
.
new
(
path:
path
)
double
(
:request
,
path:
path
)
end
end
end
end
spec/lib/constraints/user_url_constrainer_spec.rb
View file @
08d21fe8
...
@@ -11,6 +11,6 @@ describe UserUrlConstrainer, lib: true do
...
@@ -11,6 +11,6 @@ describe UserUrlConstrainer, lib: true do
end
end
def
request
(
path
)
def
request
(
path
)
OpenStruct
.
new
(
path:
path
)
double
(
:request
,
path:
path
)
end
end
end
end
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