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
b4944c18
Commit
b4944c18
authored
Mar 03, 2020
by
Luke Duncalfe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove design_management_todos_api feature flag
https://gitlab.com/gitlab-org/gitlab/issues/32492
parent
2e08c928
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
44 deletions
+16
-44
ee/lib/ee/api/todos.rb
ee/lib/ee/api/todos.rb
+0
-10
ee/spec/requests/api/todos_spec.rb
ee/spec/requests/api/todos_spec.rb
+12
-27
lib/api/todos.rb
lib/api/todos.rb
+4
-7
No files found.
ee/lib/ee/api/todos.rb
View file @
b4944c18
...
...
@@ -18,16 +18,6 @@ module EE
def
authorize_can_read!
authorize!
(
:read_epic
,
epic
)
end
override
:find_todos
def
find_todos
todos
=
super
return
todos
if
::
Feature
.
enabled?
(
:design_management_todos_api
,
default_enabled:
true
)
# Exclude Design Todos if the feature is disabled
todos
.
where
.
not
(
target_type:
::
DesignManagement
::
Design
.
name
)
# rubocop: disable CodeReuse/ActiveRecord
end
end
resource
:groups
,
requirements:
::
API
::
API
::
NAMESPACE_OR_PROJECT_REQUIREMENTS
do
...
...
ee/spec/requests/api/todos_spec.rb
View file @
b4944c18
...
...
@@ -75,39 +75,24 @@ describe API::Todos do
get
api
(
'/todos'
,
personal_access_token:
pat
)
end
context
'when the feature is enabled'
do
before
do
api_request
end
it_behaves_like
'an endpoint that responds with success'
before
do
api_request
end
it
'avoids N+1 queries'
,
:request_store
do
control
=
ActiveRecord
::
QueryRecorder
.
new
{
api_request
}
it_behaves_like
'an endpoint that responds with success'
create_todo_for_mentioned_in_design
it
'avoids N+1 queries'
,
:request_store
do
control
=
ActiveRecord
::
QueryRecorder
.
new
{
api_request
}
expect
{
api_request
}.
not_to
exceed_query_limit
(
control
)
end
create_todo_for_mentioned_in_design
it
'includes the Design Todo in the response'
do
expect
(
json_response
).
to
include
(
a_hash_including
(
'id'
=>
design_todo
.
id
)
)
end
expect
{
api_request
}.
not_to
exceed_query_limit
(
control
)
end
context
'when the feature is disabled'
do
before
do
stub_feature_flags
(
design_management_todos_api:
false
)
api_request
end
it_behaves_like
'an endpoint that responds with success'
it
'does not include the Design Todo in the response'
do
expect
(
json_response
).
to
be_empty
end
it
'includes the Design Todo in the response'
do
expect
(
json_response
).
to
include
(
a_hash_including
(
'id'
=>
design_todo
.
id
)
)
end
end
end
...
...
lib/api/todos.rb
View file @
b4944c18
...
...
@@ -13,13 +13,6 @@ module API
'issues'
=>
->
(
iid
)
{
find_project_issue
(
iid
)
}
}.
freeze
helpers
do
# EE::API::Todos would override this method
def
find_todos
TodosFinder
.
new
(
current_user
,
params
).
execute
end
end
params
do
requires
:id
,
type:
String
,
desc:
'The ID of a project'
end
...
...
@@ -48,6 +41,10 @@ module API
resource
:todos
do
helpers
do
def
find_todos
TodosFinder
.
new
(
current_user
,
params
).
execute
end
def
issuable_and_awardable?
(
type
)
obj_type
=
Object
.
const_get
(
type
,
false
)
...
...
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