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
bd92cc1e
Commit
bd92cc1e
authored
Oct 28, 2020
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature categories to all API classes with A
What it says in the title
parent
e071343a
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
28 additions
and
8 deletions
+28
-8
lib/api/access_requests.rb
lib/api/access_requests.rb
+2
-0
lib/api/admin/ci/variables.rb
lib/api/admin/ci/variables.rb
+2
-0
lib/api/admin/instance_clusters.rb
lib/api/admin/instance_clusters.rb
+2
-0
lib/api/admin/sidekiq.rb
lib/api/admin/sidekiq.rb
+2
-0
lib/api/appearance.rb
lib/api/appearance.rb
+2
-0
lib/api/applications.rb
lib/api/applications.rb
+2
-0
lib/api/avatar.rb
lib/api/avatar.rb
+2
-0
lib/api/award_emoji.rb
lib/api/award_emoji.rb
+7
-7
spec/lib/api/every_api_endpoint_spec.rb
spec/lib/api/every_api_endpoint_spec.rb
+7
-1
No files found.
lib/api/access_requests.rb
View file @
bd92cc1e
...
...
@@ -8,6 +8,8 @@ module API
helpers
::
API
::
Helpers
::
MembersHelpers
feature_category
:authentication_and_authorization
%w[group project]
.
each
do
|
source_type
|
params
do
requires
:id
,
type:
String
,
desc:
"The
#{
source_type
}
ID"
...
...
lib/api/admin/ci/variables.rb
View file @
bd92cc1e
...
...
@@ -8,6 +8,8 @@ module API
before
{
authenticated_as_admin!
}
feature_category
:continuous_integration
namespace
'admin'
do
namespace
'ci'
do
namespace
'variables'
do
...
...
lib/api/admin/instance_clusters.rb
View file @
bd92cc1e
...
...
@@ -5,6 +5,8 @@ module API
class
InstanceClusters
<
::
API
::
Base
include
PaginationParams
feature_category
:kubernetes_management
before
do
authenticated_as_admin!
end
...
...
lib/api/admin/sidekiq.rb
View file @
bd92cc1e
...
...
@@ -5,6 +5,8 @@ module API
class
Sidekiq
<
::
API
::
Base
before
{
authenticated_as_admin!
}
feature_category
:not_owned
namespace
'admin'
do
namespace
'sidekiq'
do
namespace
'queues'
do
...
...
lib/api/appearance.rb
View file @
bd92cc1e
...
...
@@ -4,6 +4,8 @@ module API
class
Appearance
<
::
API
::
Base
before
{
authenticated_as_admin!
}
feature_category
:navigation
helpers
do
def
current_appearance
@current_appearance
||=
(
::
Appearance
.
current
||
::
Appearance
.
new
)
...
...
lib/api/applications.rb
View file @
bd92cc1e
...
...
@@ -5,6 +5,8 @@ module API
class
Applications
<
::
API
::
Base
before
{
authenticated_as_admin!
}
feature_category
:authentication_and_authorization
resource
:applications
do
helpers
do
def
validate_redirect_uri
(
value
)
...
...
lib/api/avatar.rb
View file @
bd92cc1e
...
...
@@ -2,6 +2,8 @@
module
API
class
Avatar
<
::
API
::
Base
feature_category
:users
resource
:avatar
do
desc
'Return avatar url for a user'
do
success
Entities
::
Avatar
...
...
lib/api/award_emoji.rb
View file @
bd92cc1e
...
...
@@ -6,9 +6,9 @@ module API
before
{
authenticate!
}
AWARDABLES
=
[
{
type:
'issue'
,
find_by: :iid
},
{
type:
'merge_request'
,
find_by: :iid
},
{
type:
'snippet'
,
find_by: :id
}
{
type:
'issue'
,
find_by: :iid
,
feature_category: :issue_tracking
},
{
type:
'merge_request'
,
find_by: :iid
,
feature_category: :code_review
},
{
type:
'snippet'
,
find_by: :id
,
feature_category: :snippets
}
].
freeze
params
do
...
...
@@ -34,7 +34,7 @@ module API
params
do
use
:pagination
end
get
endpoint
do
get
endpoint
,
feature_category:
awardable_params
[
:feature_category
]
do
if
can_read_awardable?
awards
=
awardable
.
award_emoji
present
paginate
(
awards
),
with:
Entities
::
AwardEmoji
...
...
@@ -50,7 +50,7 @@ module API
params
do
requires
:award_id
,
type:
Integer
,
desc:
'The ID of the award'
end
get
"
#{
endpoint
}
/:award_id"
do
get
"
#{
endpoint
}
/:award_id"
,
feature_category:
awardable_params
[
:feature_category
]
do
if
can_read_awardable?
present
awardable
.
award_emoji
.
find
(
params
[
:award_id
]),
with:
Entities
::
AwardEmoji
else
...
...
@@ -65,7 +65,7 @@ module API
params
do
requires
:name
,
type:
String
,
desc:
'The name of a award_emoji (without colons)'
end
post
endpoint
do
post
endpoint
,
feature_category:
awardable_params
[
:feature_category
]
do
not_found!
(
'Award Emoji'
)
unless
can_read_awardable?
&&
can_award_awardable?
service
=
AwardEmojis
::
AddService
.
new
(
awardable
,
params
[
:name
],
current_user
).
execute
...
...
@@ -84,7 +84,7 @@ module API
params
do
requires
:award_id
,
type:
Integer
,
desc:
'The ID of an award emoji'
end
delete
"
#{
endpoint
}
/:award_id"
do
delete
"
#{
endpoint
}
/:award_id"
,
feature_category:
awardable_params
[
:feature_category
]
do
award
=
awardable
.
award_emoji
.
find
(
params
[
:award_id
])
unauthorized!
unless
award
.
user
==
current_user
||
current_user
.
admin?
...
...
spec/lib/api/every_api_endpoint_spec.rb
View file @
bd92cc1e
...
...
@@ -17,8 +17,14 @@ RSpec.describe 'Every API endpoint' do
let_it_be
(
:routes_without_category
)
do
api_endpoints
.
map
do
|
(
klass
,
path
)
|
next
if
klass
.
try
(
:feature_category_for_action
,
path
)
# We'll add the rest in https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/463
next
unless
klass
==
::
API
::
Users
||
klass
==
::
API
::
Issues
completed_classes
=
[
::
API
::
Users
,
::
API
::
Issues
,
::
API
::
AccessRequests
,
::
API
::
Admin
::
Ci
::
Variables
,
::
API
::
Admin
::
InstanceClusters
,
::
API
::
Admin
::
Sidekiq
,
::
API
::
Appearance
,
::
API
::
Applications
,
::
API
::
Avatar
,
::
API
::
AwardEmoji
]
next
unless
completed_classes
.
include?
(
klass
)
"
#{
klass
}
#
#{
path
}
"
end
.
compact
.
uniq
...
...
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