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
f2698e05
Commit
f2698e05
authored
May 21, 2019
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of 10854-elasticsearch_avoid_db
parent
bb491910
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
4 deletions
+15
-4
app/controllers/search_controller.rb
app/controllers/search_controller.rb
+1
-0
app/models/project_feature.rb
app/models/project_feature.rb
+2
-0
app/services/search_service.rb
app/services/search_service.rb
+4
-0
app/views/search/_results.html.haml
app/views/search/_results.html.haml
+1
-1
app/views/search/results/_issue.html.haml
app/views/search/results/_issue.html.haml
+1
-1
app/views/search/results/_merge_request.html.haml
app/views/search/results/_merge_request.html.haml
+1
-1
app/views/search/results/_milestone.html.haml
app/views/search/results/_milestone.html.haml
+1
-1
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+4
-0
No files found.
app/controllers/search_controller.rb
View file @
f2698e05
...
...
@@ -25,6 +25,7 @@ class SearchController < ApplicationController
@show_snippets
=
search_service
.
show_snippets?
@search_results
=
search_service
.
search_results
@search_objects
=
search_service
.
search_objects
@display_options
=
search_service
.
display_options
render_commits
if
@scope
==
'commits'
eager_load_user_status
if
@scope
==
'users'
...
...
app/models/project_feature.rb
View file @
f2698e05
...
...
@@ -72,6 +72,8 @@ class ProjectFeature < ApplicationRecord
default_value_for
:wiki_access_level
,
value:
ENABLED
,
allows_nil:
false
default_value_for
:repository_access_level
,
value:
ENABLED
,
allows_nil:
false
scope
:for_project_id
,
->
(
project
)
{
where
(
project:
project
)
}
def
feature_available?
(
feature
,
user
)
# This feature might not be behind a feature flag at all, so default to true
return
false
unless
::
Feature
.
enabled?
(
feature
,
user
,
default_enabled:
true
)
...
...
app/services/search_service.rb
View file @
f2698e05
...
...
@@ -52,6 +52,10 @@ class SearchService
@search_objects
||=
search_results
.
objects
(
scope
,
params
[
:page
])
end
def
display_options
@display_options
||=
search_results
.
display_options
(
scope
)
end
private
def
search_service
...
...
app/views/search/_results.html.haml
View file @
f2698e05
...
...
@@ -21,7 +21,7 @@
.search-results
-
if
@scope
==
'projects'
.term
=
render
'shared/projects/list'
,
projects:
@search_objects
,
pipeline_status:
false
=
render
'shared/projects/list'
,
{
projects:
@search_objects
,
pipeline_status:
false
}.
merge
(
@display_options
)
-
else
-
locals
=
{
projects:
blob_projects
(
@search_objects
)
}
if
%w[blobs wiki_blobs]
.
include?
(
@scope
)
=
render
partial:
"search/results/
#{
@scope
.
singularize
}
"
,
collection:
@search_objects
,
locals:
locals
...
...
app/views/search/results/_issue.html.haml
View file @
f2698e05
.search-result-row
%h4
=
confidential_icon
(
issue
)
=
link_to
[
issue
.
project
.
namespace
.
becomes
(
Namespace
),
issue
.
project
,
issue
]
do
=
link_to
namespace_project_issue_path
(
issue
.
project
.
namespace
.
becomes
(
Namespace
),
issue
.
project
,
issue
)
do
%span
.term.str-truncated
=
issue
.
title
-
if
issue
.
closed?
%span
.badge.badge-danger.prepend-left-5
=
_
(
"Closed"
)
...
...
app/views/search/results/_merge_request.html.haml
View file @
f2698e05
.search-result-row
%h4
=
link_to
[
merge_request
.
target_project
.
namespace
.
becomes
(
Namespace
),
merge_request
.
target_project
,
merge_request
]
do
=
link_to
namespace_project_merge_request_path
(
merge_request
.
target_project
.
namespace
.
becomes
(
Namespace
),
merge_request
.
target_project
,
merge_request
)
do
%span
.term.str-truncated
=
merge_request
.
title
-
if
merge_request
.
merged?
%span
.badge.badge-primary.prepend-left-5
=
_
(
"Merged"
)
...
...
app/views/search/results/_milestone.html.haml
View file @
f2698e05
.search-result-row
%h4
=
link_to
[
milestone
.
project
.
namespace
.
becomes
(
Namespace
),
milestone
.
project
,
milestone
]
do
=
link_to
namespace_project_milestone_path
(
milestone
.
project
.
namespace
.
becomes
(
Namespace
),
milestone
.
project
,
milestone
)
do
%span
.term.str-truncated
=
milestone
.
title
-
if
milestone
.
description
.
present?
...
...
lib/gitlab/search_results.rb
View file @
f2698e05
...
...
@@ -85,6 +85,10 @@ module Gitlab
UsersFinder
.
new
(
current_user
,
search:
query
).
execute
end
def
display_options
(
_scope
)
{}
end
private
def
projects
...
...
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