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
e4e92b82
Commit
e4e92b82
authored
Oct 11, 2021
by
Nicolò Maria Mezzopera
Committed by
Tetiana Chupryna
Oct 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add can_destroy to GraphQL package type
parent
9266531e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
2 deletions
+13
-2
app/graphql/types/packages/package_type.rb
app/graphql/types/packages/package_type.rb
+5
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+2
-0
spec/fixtures/api/schemas/graphql/packages/package_details.json
...ixtures/api/schemas/graphql/packages/package_details.json
+5
-1
spec/graphql/types/packages/package_type_spec.rb
spec/graphql/types/packages/package_type_spec.rb
+1
-1
No files found.
app/graphql/types/packages/package_type.rb
View file @
e4e92b82
...
...
@@ -28,6 +28,7 @@ module Types
description:
'Other versions of the package.'
,
deprecated:
{
reason:
'This field is now only returned in the PackageDetailsType'
,
milestone:
'13.11'
}
field
:status
,
Types
::
Packages
::
PackageStatusEnum
,
null:
false
,
description:
'Package status.'
field
:can_destroy
,
GraphQL
::
Types
::
Boolean
,
null:
false
,
description:
'Whether the user can destroy the package.'
def
project
Gitlab
::
Graphql
::
Loaders
::
BatchModelLoader
.
new
(
Project
,
object
.
project_id
).
find
...
...
@@ -37,6 +38,10 @@ module Types
[]
end
def
can_destroy
Ability
.
allowed?
(
current_user
,
:destroy_package
,
object
)
end
# NOTE: This method must be kept in sync with the union
# type: `Types::Packages::MetadataType`.
#
...
...
doc/api/graphql/reference/index.md
View file @
e4e92b82
...
...
@@ -12145,6 +12145,7 @@ Represents a package in the Package Registry. Note that this type is in beta and
| Name | Type | Description |
| ---- | ---- | ----------- |
|
<a
id=
"packagecandestroy"
></a>
`canDestroy`
|
[
`Boolean!`
](
#boolean
)
| Whether the user can destroy the package. |
|
<a
id=
"packagecreatedat"
></a>
`createdAt`
|
[
`Time!`
](
#time
)
| Date of creation. |
|
<a
id=
"packageid"
></a>
`id`
|
[
`PackagesPackageID!`
](
#packagespackageid
)
| ID of the package. |
|
<a
id=
"packagemetadata"
></a>
`metadata`
|
[
`PackageMetadata`
](
#packagemetadata
)
| Package metadata. |
...
...
@@ -12204,6 +12205,7 @@ Represents a package details in the Package Registry. Note that this type is in
| Name | Type | Description |
| ---- | ---- | ----------- |
|
<a
id=
"packagedetailstypecandestroy"
></a>
`canDestroy`
|
[
`Boolean!`
](
#boolean
)
| Whether the user can destroy the package. |
|
<a
id=
"packagedetailstypecreatedat"
></a>
`createdAt`
|
[
`Time!`
](
#time
)
| Date of creation. |
|
<a
id=
"packagedetailstypedependencylinks"
></a>
`dependencyLinks`
|
[
`PackageDependencyLinkConnection`
](
#packagedependencylinkconnection
)
| Dependency link. (see
[
Connections
](
#connections
)
) |
|
<a
id=
"packagedetailstypeid"
></a>
`id`
|
[
`PackagesPackageID!`
](
#packagespackageid
)
| ID of the package. |
...
...
spec/fixtures/api/schemas/graphql/packages/package_details.json
View file @
e4e92b82
...
...
@@ -13,7 +13,8 @@
"pipelines"
,
"versions"
,
"metadata"
,
"status"
"status"
,
"canDestroy"
],
"properties"
:
{
"id"
:
{
...
...
@@ -31,6 +32,9 @@
"version"
:
{
"type"
:
[
"string"
,
"null"
]
},
"canDestroy"
:
{
"type"
:
[
"boolean"
]
},
"packageType"
:
{
"type"
:
[
"string"
],
"enum"
:
[
...
...
spec/graphql/types/packages/package_type_spec.rb
View file @
e4e92b82
...
...
@@ -9,7 +9,7 @@ RSpec.describe GitlabSchema.types['Package'] do
created_at updated_at
project
tags pipelines metadata versions
status
status
can_destroy
]
expect
(
described_class
).
to
include_graphql_fields
(
*
expected_fields
)
...
...
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