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
e1670b92
Commit
e1670b92
authored
Jul 21, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added webPath fields to repository entries
Also added description HTML field to the commit type
parent
b3d6ac29
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
138 additions
and
4 deletions
+138
-4
app/graphql/types/commit_type.rb
app/graphql/types/commit_type.rb
+3
-0
app/graphql/types/tree/blob_type.rb
app/graphql/types/tree/blob_type.rb
+2
-0
app/graphql/types/tree/tree_entry_type.rb
app/graphql/types/tree/tree_entry_type.rb
+2
-0
app/graphql/types/user_type.rb
app/graphql/types/user_type.rb
+2
-0
app/presenters/blob_presenter.rb
app/presenters/blob_presenter.rb
+4
-0
app/presenters/commit_presenter.rb
app/presenters/commit_presenter.rb
+4
-0
app/presenters/tree_entry_presenter.rb
app/presenters/tree_entry_presenter.rb
+4
-0
app/presenters/user_presenter.rb
app/presenters/user_presenter.rb
+4
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+25
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+78
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+5
-0
spec/graphql/types/commit_type_spec.rb
spec/graphql/types/commit_type_spec.rb
+2
-2
spec/graphql/types/tree/blob_type_spec.rb
spec/graphql/types/tree/blob_type_spec.rb
+1
-1
spec/graphql/types/tree/tree_entry_type_spec.rb
spec/graphql/types/tree/tree_entry_type_spec.rb
+1
-1
spec/graphql/types/user_type_spec.rb
spec/graphql/types/user_type_spec.rb
+1
-0
No files found.
app/graphql/types/commit_type.rb
View file @
e1670b92
...
...
@@ -17,12 +17,15 @@ module Types
markdown_field
:title_html
,
null:
true
field
:description
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Description of the commit message'
markdown_field
:description_html
,
null:
true
field
:message
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Raw commit message'
field
:authored_date
,
type:
Types
::
TimeType
,
null:
true
,
description:
'Timestamp of when the commit was authored'
field
:web_url
,
type:
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web URL of the commit'
field
:web_path
,
type:
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web path of the commit'
field
:signature_html
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
calls_gitaly:
true
,
description:
'Rendered HTML of the commit signature'
field
:author_name
,
type:
GraphQL
::
STRING_TYPE
,
null:
true
,
...
...
app/graphql/types/tree/blob_type.rb
View file @
e1670b92
...
...
@@ -12,6 +12,8 @@ module Types
field
:web_url
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Web URL of the blob'
field
:web_path
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Web path of the blob'
field
:lfs_oid
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'LFS ID of the blob'
,
resolve:
->
(
blob
,
args
,
ctx
)
do
...
...
app/graphql/types/tree/tree_entry_type.rb
View file @
e1670b92
...
...
@@ -13,6 +13,8 @@ module Types
field
:web_url
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Web URL for the tree entry (directory)'
field
:web_path
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'Web path for the tree entry (directory)'
end
# rubocop: enable Graphql/AuthorizeTypes
end
...
...
app/graphql/types/user_type.rb
View file @
e1670b92
...
...
@@ -22,6 +22,8 @@ module Types
description:
"URL of the user's avatar"
field
:web_url
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web URL of the user'
field
:web_path
,
GraphQL
::
STRING_TYPE
,
null:
false
,
description:
'Web path of the user'
field
:todos
,
Types
::
TodoType
.
connection_type
,
null:
false
,
resolver:
Resolvers
::
TodoResolver
,
description:
'Todos of the user'
...
...
app/presenters/blob_presenter.rb
View file @
e1670b92
...
...
@@ -18,6 +18,10 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated
Gitlab
::
Routing
.
url_helpers
.
project_blob_url
(
blob
.
repository
.
project
,
File
.
join
(
blob
.
commit_id
,
blob
.
path
))
end
def
web_path
Gitlab
::
Routing
.
url_helpers
.
project_blob_path
(
blob
.
repository
.
project
,
File
.
join
(
blob
.
commit_id
,
blob
.
path
))
end
private
def
load_all_blob_data
...
...
app/presenters/commit_presenter.rb
View file @
e1670b92
...
...
@@ -21,6 +21,10 @@ class CommitPresenter < Gitlab::View::Presenter::Delegated
url_builder
.
build
(
commit
)
end
def
web_path
url_builder
.
build
(
commit
,
only_path:
true
)
end
def
signature_html
return
unless
commit
.
has_signature?
...
...
app/presenters/tree_entry_presenter.rb
View file @
e1670b92
...
...
@@ -6,4 +6,8 @@ class TreeEntryPresenter < Gitlab::View::Presenter::Delegated
def
web_url
Gitlab
::
Routing
.
url_helpers
.
project_tree_url
(
tree
.
repository
.
project
,
File
.
join
(
tree
.
commit_id
,
tree
.
path
))
end
def
web_path
Gitlab
::
Routing
.
url_helpers
.
project_tree_path
(
tree
.
repository
.
project
,
File
.
join
(
tree
.
commit_id
,
tree
.
path
))
end
end
app/presenters/user_presenter.rb
View file @
e1670b92
...
...
@@ -6,4 +6,8 @@ class UserPresenter < Gitlab::View::Presenter::Delegated
def
web_url
Gitlab
::
Routing
.
url_helpers
.
user_url
(
user
)
end
def
web_path
Gitlab
::
Routing
.
url_helpers
.
user_path
(
user
)
end
end
doc/api/graphql/reference/gitlab_schema.graphql
View file @
e1670b92
...
...
@@ -873,6 +873,11 @@ type Blob implements Entry {
"""
type
:
EntryType
!
"""
Web
path
of
the
blob
"""
webPath
:
String
"""
Web
URL
of
the
blob
"""
...
...
@@ -1186,6 +1191,11 @@ type Commit {
"""
description
:
String
"""
The
GitLab
Flavored
Markdown
rendering
of
`
description
`
"""
descriptionHtml
:
String
"""
ID
(
global
ID
)
of
the
commit
"""
...
...
@@ -1276,6 +1286,11 @@ type Commit {
"""
titleHtml
:
String
"""
Web
path
of
the
commit
"""
webPath
:
String
!
"""
Web
URL
of
the
commit
"""
...
...
@@ -13664,6 +13679,11 @@ type TreeEntry implements Entry {
"""
type
:
EntryType
!
"""
Web
path
for
the
tree
entry
(
directory
)
"""
webPath
:
String
"""
Web
URL
for
the
tree
entry
(
directory
)
"""
...
...
@@ -14570,6 +14590,11 @@ type User {
"""
username
:
String
!
"""
Web
path
of
the
user
"""
webPath
:
String
!
"""
Web
URL
of
the
user
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
e1670b92
...
...
@@ -2300,6 +2300,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the blob",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL of the blob",
...
...
@@ -3244,6 +3258,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "descriptionHtml",
"description": "The GitLab Flavored Markdown rendering of `description`",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "id",
"description": "ID (global ID) of the commit",
...
...
@@ -3462,6 +3490,24 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the commit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL of the commit",
...
...
@@ -40433,6 +40479,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path for the tree entry (directory)",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL for the tree entry (directory)",
...
...
@@ -42864,6 +42924,24 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webPath",
"description": "Web path of the user",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "webUrl",
"description": "Web URL of the user",
doc/api/graphql/reference/index.md
View file @
e1670b92
...
...
@@ -178,6 +178,7 @@ Autogenerated return type of AwardEmojiToggle
|
`path`
| String! | Path of the entry |
|
`sha`
| String! | Last commit sha for the entry |
|
`type`
| EntryType! | Type of tree entry |
|
`webPath`
| String | Web path of the blob |
|
`webUrl`
| String | Web URL of the blob |
## Board
...
...
@@ -234,6 +235,7 @@ Autogenerated return type of BoardListUpdateLimitMetrics
|
`authorName`
| String | Commit authors name |
|
`authoredDate`
| Time | Timestamp of when the commit was authored |
|
`description`
| String | Description of the commit message |
|
`descriptionHtml`
| String | The GitLab Flavored Markdown rendering of
`description`
|
|
`id`
| ID! | ID (global ID) of the commit |
|
`latestPipeline`
**{warning-solid}**
| Pipeline |
**Deprecated:**
Use
`pipelines`
. Deprecated in 12.5 |
|
`message`
| String | Raw commit message |
...
...
@@ -241,6 +243,7 @@ Autogenerated return type of BoardListUpdateLimitMetrics
|
`signatureHtml`
| String | Rendered HTML of the commit signature |
|
`title`
| String | Title of the commit message |
|
`titleHtml`
| String | The GitLab Flavored Markdown rendering of
`title`
|
|
`webPath`
| String! | Web path of the commit |
|
`webUrl`
| String! | Web URL of the commit |
## CommitCreatePayload
...
...
@@ -2072,6 +2075,7 @@ Represents a directory
|
`path`
| String! | Path of the entry |
|
`sha`
| String! | Last commit sha for the entry |
|
`type`
| EntryType! | Type of tree entry |
|
`webPath`
| String | Web path for the tree entry (directory) |
|
`webUrl`
| String | Web URL for the tree entry (directory) |
## UpdateAlertStatusPayload
...
...
@@ -2176,6 +2180,7 @@ Autogenerated return type of UpdateSnippet
|
`state`
| UserState! | State of the user |
|
`userPermissions`
| UserPermissions! | Permissions for the current user on the resource |
|
`username`
| String! | Username of the user. Unique within this instance of GitLab |
|
`webPath`
| String! | Web path of the user |
|
`webUrl`
| String! | Web URL of the user |
## UserPermissions
...
...
spec/graphql/types/commit_type_spec.rb
View file @
e1670b92
...
...
@@ -9,8 +9,8 @@ RSpec.describe GitlabSchema.types['Commit'] do
it
'contains attributes related to commit'
do
expect
(
described_class
).
to
have_graphql_fields
(
:id
,
:sha
,
:title
,
:description
,
:message
,
:title_html
,
:authored_date
,
:author_name
,
:author_gravatar
,
:author
,
:web_url
,
:latest_pipeline
,
:id
,
:sha
,
:title
,
:description
,
:
description_html
,
:
message
,
:title_html
,
:authored_date
,
:author_name
,
:author_gravatar
,
:author
,
:web_url
,
:
web_path
,
:
latest_pipeline
,
:pipelines
,
:signature_html
)
end
...
...
spec/graphql/types/tree/blob_type_spec.rb
View file @
e1670b92
...
...
@@ -5,5 +5,5 @@ require 'spec_helper'
RSpec
.
describe
Types
::
Tree
::
BlobType
do
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'Blob'
)
}
specify
{
expect
(
described_class
).
to
have_graphql_fields
(
:id
,
:sha
,
:name
,
:type
,
:path
,
:flat_path
,
:web_url
,
:lfs_oid
,
:mode
)
}
specify
{
expect
(
described_class
).
to
have_graphql_fields
(
:id
,
:sha
,
:name
,
:type
,
:path
,
:flat_path
,
:web_url
,
:
web_path
,
:
lfs_oid
,
:mode
)
}
end
spec/graphql/types/tree/tree_entry_type_spec.rb
View file @
e1670b92
...
...
@@ -5,5 +5,5 @@ require 'spec_helper'
RSpec
.
describe
Types
::
Tree
::
TreeEntryType
do
specify
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'TreeEntry'
)
}
specify
{
expect
(
described_class
).
to
have_graphql_fields
(
:id
,
:sha
,
:name
,
:type
,
:path
,
:flat_path
,
:web_url
)
}
specify
{
expect
(
described_class
).
to
have_graphql_fields
(
:id
,
:sha
,
:name
,
:type
,
:path
,
:flat_path
,
:web_url
,
:web_path
)
}
end
spec/graphql/types/user_type_spec.rb
View file @
e1670b92
...
...
@@ -16,6 +16,7 @@ RSpec.describe GitlabSchema.types['User'] do
username
avatarUrl
webUrl
webPath
todos
state
authoredMergeRequests
...
...
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