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
Jérome Perrin
gitlab-ce
Commits
ba2d7eda
Commit
ba2d7eda
authored
Jan 30, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve search within group logic
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
fae9814e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
app/models/project.rb
app/models/project.rb
+1
-0
app/services/search/global_service.rb
app/services/search/global_service.rb
+1
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+8
-0
No files found.
app/models/project.rb
View file @
ba2d7eda
...
@@ -225,6 +225,7 @@ class Project < ActiveRecord::Base
...
@@ -225,6 +225,7 @@ class Project < ActiveRecord::Base
scope
:with_project_feature
,
->
{
joins
(
'LEFT JOIN project_features ON projects.id = project_features.project_id'
)
}
scope
:with_project_feature
,
->
{
joins
(
'LEFT JOIN project_features ON projects.id = project_features.project_id'
)
}
scope
:with_statistics
,
->
{
includes
(
:statistics
)
}
scope
:with_statistics
,
->
{
includes
(
:statistics
)
}
scope
:with_shared_runners
,
->
{
where
(
shared_runners_enabled:
true
)
}
scope
:with_shared_runners
,
->
{
where
(
shared_runners_enabled:
true
)
}
scope
:inside_path
,
->
(
path
)
{
joins
(
:route
).
where
(
'routes.path LIKE ?'
,
"
#{
path
}
/%"
)
}
# "enabled" here means "not disabled". It includes private features!
# "enabled" here means "not disabled". It includes private features!
scope
:with_feature_enabled
,
->
(
feature
)
{
scope
:with_feature_enabled
,
->
(
feature
)
{
...
...
app/services/search/global_service.rb
View file @
ba2d7eda
...
@@ -11,8 +11,7 @@ module Search
...
@@ -11,8 +11,7 @@ module Search
projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
if
group
if
group
ids
=
group
.
descendants
.
push
(
group
.
id
)
projects
=
projects
.
inside_path
(
group
.
full_path
)
projects
=
projects
.
in_namespace
(
ids
)
end
end
Gitlab
::
SearchResults
.
new
(
current_user
,
projects
,
params
[
:search
])
Gitlab
::
SearchResults
.
new
(
current_user
,
projects
,
params
[
:search
])
...
...
spec/models/project_spec.rb
View file @
ba2d7eda
...
@@ -1833,6 +1833,14 @@ describe Project, models: true do
...
@@ -1833,6 +1833,14 @@ describe Project, models: true do
end
end
end
end
describe
'inside_path'
do
let!
(
:project1
)
{
create
(
:empty_project
)
}
let!
(
:project2
)
{
create
(
:empty_project
)
}
let!
(
:path
)
{
project1
.
namespace
.
path
}
it
{
expect
(
Project
.
inside_path
(
path
)).
to
eq
([
project1
])
}
end
def
enable_lfs
def
enable_lfs
allow
(
Gitlab
.
config
.
lfs
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
lfs
).
to
receive
(
:enabled
).
and_return
(
true
)
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