Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
d63157c7e2d0
Commit
d63157c7
authored
Oct 21, 2015
by
Douwe Maan
Browse files
Move case sensitivity check to find_with_namespace.
parent
32b1b5420579
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/application_controller.rb
View file @
d63157c7
...
...
@@ -118,8 +118,7 @@
end
project_path
=
"
#{
namespace
}
/
#{
id
}
"
@project
=
Project
.
find_with_namespace
(
project_path
)
||
Project
.
find_with_namespace
(
project_path
,
case_sensitive:
false
)
@project
=
Project
.
find_with_namespace
(
project_path
)
if
@project
and
can?
(
current_user
,
:read_project
,
@project
)
if
@project
.
path_with_namespace
!=
project_path
...
...
app/models/project.rb
View file @
d63157c7
...
...
@@ -235,7 +235,7 @@
where
(
'projects.archived = ?'
,
false
).
where
(
'LOWER(projects.name) LIKE :query'
,
query:
"%
#{
query
.
downcase
}
%"
)
end
def
find_with_namespace
(
id
,
case_sensitive:
true
)
def
find_with_namespace
(
id
)
namespace_path
,
project_path
=
id
.
split
(
'/'
)
return
nil
if
!
namespace_path
||
!
project_path
...
...
@@ -247,14 +247,8 @@
joins
(
:namespace
).
iwhere
(
'namespaces.path'
=>
namespace_path
)
projects
=
if
case_sensitive
projects
.
where
(
'projects.path'
=>
project_path
)
else
projects
.
iwhere
(
'projects.path'
=>
project_path
)
end
projects
.
take
projects
.
where
(
'projects.path'
=>
project_path
).
take
||
projects
.
iwhere
(
'projects.path'
=>
project_path
).
take
end
def
visibility_levels
...
...
Write
Preview
Supports
Markdown
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