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
bb728ba4
Commit
bb728ba4
authored
Apr 07, 2021
by
Changzheng Liu
Committed by
Michael Kozono
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Land on epics tab when searching within epics search context
parent
a74d08ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
0 deletions
+92
-0
ee/changelogs/unreleased/287921-epics-scope-group-level-search.yml
...logs/unreleased/287921-epics-scope-group-level-search.yml
+5
-0
ee/lib/ee/gitlab/search_context.rb
ee/lib/ee/gitlab/search_context.rb
+20
-0
ee/spec/lib/gitlab/search_context/builder_spec.rb
ee/spec/lib/gitlab/search_context/builder_spec.rb
+27
-0
ee/spec/views/layouts/_search.html.haml_spec.rb
ee/spec/views/layouts/_search.html.haml_spec.rb
+38
-0
lib/gitlab/search_context.rb
lib/gitlab/search_context.rb
+2
-0
No files found.
ee/changelogs/unreleased/287921-epics-scope-group-level-search.yml
0 → 100644
View file @
bb728ba4
---
title
:
Land on epics tab when searching within epics search context
merge_request
:
58201
author
:
type
:
fixed
ee/lib/ee/gitlab/search_context.rb
0 → 100644
View file @
bb728ba4
# frozen_string_literal: true
module
EE
module
Gitlab
module
SearchContext
module
Builder
extend
::
Gitlab
::
Utils
::
Override
override
:search_scope
def
search_scope
if
view_context
.
current_controller?
(
:epics
)
'epics'
else
super
end
end
end
end
end
end
ee/spec/lib/gitlab/search_context/builder_spec.rb
0 → 100644
View file @
bb728ba4
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
SearchContext
::
Builder
,
type: :controller
do
controller
(
ApplicationController
)
{
}
subject
(
:builder
)
{
described_class
.
new
(
controller
.
view_context
)
}
describe
'#with_group'
do
let
(
:group
)
{
create
(
:group
)
}
describe
'#build!'
do
subject
(
:context
)
{
builder
.
with_group
(
group
).
build!
}
context
'with epics scope'
do
before
do
allow
(
controller
).
to
receive
(
:controller_name
).
and_return
(
'epics'
)
end
it
'search context returns epics scope'
do
expect
(
subject
.
scope
).
to
be
(
'epics'
)
end
end
end
end
end
ee/spec/views/layouts/_search.html.haml_spec.rb
0 → 100644
View file @
bb728ba4
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'layouts/_search'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
nil
}
let
(
:scope
)
{
'epics'
}
let
(
:search_context
)
do
instance_double
(
Gitlab
::
SearchContext
,
project:
project
,
group:
group
,
scope:
scope
,
ref:
nil
,
snippets:
[],
search_url:
'/search'
,
project_metadata:
{},
group_metadata:
{})
end
before
do
allow
(
view
).
to
receive
(
:search_context
).
and_return
(
search_context
)
allow
(
search_context
).
to
receive
(
:code_search?
).
and_return
(
false
)
allow
(
search_context
).
to
receive
(
:for_snippets?
).
and_return
(
false
)
allow
(
search_context
).
to
receive
(
:for_project?
).
and_return
(
false
)
allow
(
search_context
).
to
receive
(
:for_group?
).
and_return
(
true
)
end
context
'when doing group level search'
do
context
'when on epics'
do
it
'sets scope to epics'
do
render
expect
(
rendered
).
to
have_css
(
"input[name='scope'][value='epics']"
,
count:
1
,
visible:
false
)
end
end
end
end
lib/gitlab/search_context.rb
View file @
bb728ba4
...
...
@@ -163,3 +163,5 @@ module Gitlab
end
end
end
Gitlab
::
SearchContext
::
Builder
.
prepend_ee_mod
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