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
1d43d927
Commit
1d43d927
authored
Sep 29, 2021
by
Terri Chu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move advanced_search_multi_project_select FF to user actor
Changelog: changed EE: true
parent
19e391ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
27 deletions
+13
-27
config/feature_flags/development/advanced_search_multi_project_select.yml
...lags/development/advanced_search_multi_project_select.yml
+1
-1
ee/app/services/ee/search_service.rb
ee/app/services/ee/search_service.rb
+1
-1
ee/spec/services/search_service_spec.rb
ee/spec/services/search_service_spec.rb
+11
-25
No files found.
config/feature_flags/development/advanced_search_multi_project_select.yml
View file @
1d43d927
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
name
:
advanced_search_multi_project_select
name
:
advanced_search_multi_project_select
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62606
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62606
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/333011
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/333011
milestone
:
'
14.
0
'
milestone
:
'
14.
4
'
type
:
development
type
:
development
group
:
group::global search
group
:
group::global search
default_enabled
:
false
default_enabled
:
false
ee/app/services/ee/search_service.rb
View file @
1d43d927
...
@@ -37,7 +37,7 @@ module EE
...
@@ -37,7 +37,7 @@ module EE
def
projects
def
projects
strong_memoize
(
:projects
)
do
strong_memoize
(
:projects
)
do
next
unless
params
[
:project_ids
].
present?
&&
params
[
:project_ids
].
is_a?
(
String
)
next
unless
params
[
:project_ids
].
present?
&&
params
[
:project_ids
].
is_a?
(
String
)
next
unless
group
.
present?
&&
::
Feature
.
enabled?
(
:advanced_search_multi_project_select
,
group
)
next
unless
::
Feature
.
enabled?
(
:advanced_search_multi_project_select
,
current_user
,
default_enabled: :yaml
)
project_ids
=
params
[
:project_ids
].
split
(
','
)
project_ids
=
params
[
:project_ids
].
split
(
','
)
the_projects
=
::
Project
.
where
(
id:
project_ids
)
the_projects
=
::
Project
.
where
(
id:
project_ids
)
...
...
ee/spec/services/search_service_spec.rb
View file @
1d43d927
...
@@ -221,20 +221,15 @@ RSpec.describe SearchService do
...
@@ -221,20 +221,15 @@ RSpec.describe SearchService do
describe
'#projects'
do
describe
'#projects'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:accessible_project
)
{
create
(
:project
,
:public
)
}
let_it_be
(
:accessible_project
)
{
create
(
:project
,
:public
,
namespace:
group
)
}
let_it_be
(
:inaccessible_project
)
{
create
(
:project
,
:private
)
}
let_it_be
(
:inaccessible_project
)
{
create
(
:project
,
:private
,
namespace:
group
)
}
before
do
stub_feature_flags
(
advanced_search_multi_project_select:
group
)
end
context
'when all projects are accessible'
do
context
'when all projects are accessible'
do
let_it_be
(
:accessible_project_2
)
{
create
(
:project
,
:public
,
namespace:
group
)
}
let_it_be
(
:accessible_project_2
)
{
create
(
:project
,
:public
)
}
it
'returns the project'
do
it
'returns the project'
do
project_ids
=
[
accessible_project
.
id
,
accessible_project_2
.
id
].
join
(
','
)
project_ids
=
[
accessible_project
.
id
,
accessible_project_2
.
id
].
join
(
','
)
projects
=
described_class
.
new
(
user
,
group_id:
group
.
id
,
project_ids:
project_ids
).
projects
projects
=
described_class
.
new
(
user
,
project_ids:
project_ids
).
projects
expect
(
projects
).
to
match_array
[
accessible_project
,
accessible_project_2
]
expect
(
projects
).
to
match_array
[
accessible_project
,
accessible_project_2
]
end
end
...
@@ -243,21 +238,21 @@ RSpec.describe SearchService do
...
@@ -243,21 +238,21 @@ RSpec.describe SearchService do
search_project
=
create
:project
search_project
=
create
:project
search_project
.
add_guest
(
user
)
search_project
.
add_guest
(
user
)
project_ids
=
[
accessible_project
.
id
,
accessible_project_2
.
id
,
search_project
.
id
].
join
(
','
)
project_ids
=
[
accessible_project
.
id
,
accessible_project_2
.
id
,
search_project
.
id
].
join
(
','
)
projects
=
described_class
.
new
(
user
,
group_id:
group
.
id
,
project_ids:
project_ids
).
projects
projects
=
described_class
.
new
(
user
,
project_ids:
project_ids
).
projects
expect
(
projects
).
to
match_array
[
accessible_project
,
accessible_project_2
,
search_project
]
expect
(
projects
).
to
match_array
[
accessible_project
,
accessible_project_2
,
search_project
]
end
end
it
'handles spaces in the param'
do
it
'handles spaces in the param'
do
project_ids
=
[
accessible_project
.
id
,
accessible_project_2
.
id
].
join
(
', '
)
project_ids
=
[
accessible_project
.
id
,
accessible_project_2
.
id
].
join
(
', '
)
projects
=
described_class
.
new
(
user
,
group_id:
group
.
id
,
project_ids:
project_ids
).
projects
projects
=
described_class
.
new
(
user
,
project_ids:
project_ids
).
projects
expect
(
projects
).
to
match_array
[
accessible_project
,
accessible_project_2
]
expect
(
projects
).
to
match_array
[
accessible_project
,
accessible_project_2
]
end
end
it
'returns nil if projects param is not a String'
do
it
'returns nil if projects param is not a String'
do
project_ids
=
accessible_project
.
id
project_ids
=
accessible_project
.
id
projects
=
described_class
.
new
(
user
,
group_id:
group
.
id
,
project_ids:
project_ids
).
projects
projects
=
described_class
.
new
(
user
,
project_ids:
project_ids
).
projects
expect
(
projects
).
to
be_nil
expect
(
projects
).
to
be_nil
end
end
...
@@ -266,7 +261,7 @@ RSpec.describe SearchService do
...
@@ -266,7 +261,7 @@ RSpec.describe SearchService do
context
'when some projects are accessible'
do
context
'when some projects are accessible'
do
it
'returns only accessible projects'
do
it
'returns only accessible projects'
do
project_ids
=
[
accessible_project
.
id
,
inaccessible_project
.
id
].
join
(
','
)
project_ids
=
[
accessible_project
.
id
,
inaccessible_project
.
id
].
join
(
','
)
projects
=
described_class
.
new
(
user
,
group_id:
group
.
id
,
project_ids:
project_ids
).
projects
projects
=
described_class
.
new
(
user
,
project_ids:
project_ids
).
projects
expect
(
projects
).
to
match_array
[
accessible_project
]
expect
(
projects
).
to
match_array
[
accessible_project
]
end
end
...
@@ -275,7 +270,7 @@ RSpec.describe SearchService do
...
@@ -275,7 +270,7 @@ RSpec.describe SearchService do
context
'when no projects are accessible'
do
context
'when no projects are accessible'
do
it
'returns nil'
do
it
'returns nil'
do
project_ids
=
"
#{
inaccessible_project
.
id
}
"
project_ids
=
"
#{
inaccessible_project
.
id
}
"
projects
=
described_class
.
new
(
user
,
group_id:
group
.
id
,
project_ids:
project_ids
).
projects
projects
=
described_class
.
new
(
user
,
project_ids:
project_ids
).
projects
expect
(
projects
).
to
be_nil
expect
(
projects
).
to
be_nil
end
end
...
@@ -289,23 +284,14 @@ RSpec.describe SearchService do
...
@@ -289,23 +284,14 @@ RSpec.describe SearchService do
end
end
end
end
context
'when no group_id provided'
do
context
'when the advanced_search_multi_project_select feature is not enabled'
do
it
'returns nil'
do
project_ids
=
"
#{
accessible_project
.
id
}
"
projects
=
described_class
.
new
(
user
,
project_ids:
project_ids
).
projects
expect
(
projects
).
to
be_nil
end
end
context
'when the advanced_search_multi_project_select feature is not enabled for the group'
do
before
do
before
do
stub_feature_flags
(
advanced_search_multi_project_select:
false
)
stub_feature_flags
(
advanced_search_multi_project_select:
false
)
end
end
it
'returns nil'
do
it
'returns nil'
do
project_ids
=
"
#{
accessible_project
.
id
}
"
project_ids
=
"
#{
accessible_project
.
id
}
"
projects
=
described_class
.
new
(
user
,
group_id:
group
.
id
,
project_ids:
project_ids
).
projects
projects
=
described_class
.
new
(
user
,
project_ids:
project_ids
).
projects
expect
(
projects
).
to
be_nil
expect
(
projects
).
to
be_nil
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