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
4532823f
Commit
4532823f
authored
Sep 08, 2020
by
Lee Tickett
Committed by
Heinrich Lee Yu
Sep 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add note to graphql timelog_type
parent
b050cbf8
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
54 additions
and
3 deletions
+54
-3
app/models/note.rb
app/models/note.rb
+2
-0
app/models/timelog.rb
app/models/timelog.rb
+1
-0
changelogs/unreleased/expose_time_note_from_api.yml
changelogs/unreleased/expose_time_note_from_api.yml
+5
-0
doc/api/graphql/reference/gitlab_schema.graphql
doc/api/graphql/reference/gitlab_schema.graphql
+5
-0
doc/api/graphql/reference/gitlab_schema.json
doc/api/graphql/reference/gitlab_schema.json
+14
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
ee/app/graphql/ee/types/group_type.rb
ee/app/graphql/ee/types/group_type.rb
+1
-0
ee/app/graphql/resolvers/timelog_resolver.rb
ee/app/graphql/resolvers/timelog_resolver.rb
+10
-2
ee/app/graphql/types/timelog_type.rb
ee/app/graphql/types/timelog_type.rb
+5
-0
ee/spec/graphql/types/timelog_type_spec.rb
ee/spec/graphql/types/timelog_type_spec.rb
+9
-1
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-0
No files found.
app/models/note.rb
View file @
4532823f
...
...
@@ -556,6 +556,8 @@ class Note < ApplicationRecord
end
def
system_note_with_references_visible_for?
(
user
)
return
true
unless
system
?
(
!
system_note_with_references?
||
all_referenced_mentionables_allowed?
(
user
))
&&
system_note_viewable_by?
(
user
)
end
...
...
app/models/timelog.rb
View file @
4532823f
...
...
@@ -7,6 +7,7 @@ class Timelog < ApplicationRecord
belongs_to
:issue
,
touch:
true
belongs_to
:merge_request
,
touch:
true
belongs_to
:user
belongs_to
:note
scope
:for_issues_in_group
,
->
(
group
)
do
joins
(
:issue
).
where
(
...
...
changelogs/unreleased/expose_time_note_from_api.yml
0 → 100644
View file @
4532823f
---
title
:
Add note to graphql timelog_type
merge_request
:
37748
author
:
Lee Tickett
type
:
added
doc/api/graphql/reference/gitlab_schema.graphql
View file @
4532823f
...
...
@@ -16052,6 +16052,11 @@ type Timelog {
"""
issue
:
Issue
"""
The
note
where
the
quick
action
to
add
the
logged
time
was
executed
"""
note
:
Note
"""
Timestamp
of
when
the
time
tracked
was
spent
at
"""
...
...
doc/api/graphql/reference/gitlab_schema.json
View file @
4532823f
...
...
@@ -47222,6 +47222,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "note",
"description": "The note where the quick action to add the logged time was executed",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "Note",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "spentAt",
"description": "Timestamp of when the time tracked was spent at",
doc/api/graphql/reference/index.md
View file @
4532823f
...
...
@@ -2351,6 +2351,7 @@ Represents a requirement test report.
| --- | ---- | ---------- |
|
`date`
**{warning-solid}**
| Time! |
**Deprecated:**
Use
`spentAt`
. Deprecated in 12.10 |
|
`issue`
| Issue | The issue that logged time was added to |
|
`note`
| Note | The note where the quick action to add the logged time was executed |
|
`spentAt`
| Time | Timestamp of when the time tracked was spent at |
|
`timeSpent`
| Int! | The time spent displayed in seconds |
|
`user`
| User! | The user that logged the time |
...
...
ee/app/graphql/ee/types/group_type.rb
View file @
4532823f
...
...
@@ -27,6 +27,7 @@ module EE
field
:timelogs
,
::
Types
::
TimelogType
.
connection_type
,
null:
false
,
description:
'Time logged in issues by group members'
,
extras:
[
:lookahead
],
complexity:
5
,
resolver:
::
Resolvers
::
TimelogResolver
...
...
ee/app/graphql/resolvers/timelog_resolver.rb
View file @
4532823f
...
...
@@ -2,6 +2,8 @@
module
Resolvers
class
TimelogResolver
<
BaseResolver
include
LooksAhead
argument
:start_date
,
Types
::
TimeType
,
required:
false
,
description:
'List time logs within a date range where the logged date is equal to or after startDate'
...
...
@@ -18,7 +20,7 @@ module Resolvers
required:
false
,
description:
'List time-logs within a time range where the logged time is equal to or before endTime'
def
resolve
(
**
args
)
def
resolve
_with_lookahead
(
**
args
)
return
Timelog
.
none
unless
timelogs_available_for_user?
validate_params_presence!
(
args
)
...
...
@@ -30,8 +32,14 @@ module Resolvers
private
def
preloads
{
note:
[
:note
]
}
end
def
find_timelogs
(
args
)
group
.
timelogs
(
args
[
:start_time
],
args
[
:end_time
]
)
apply_lookahead
(
group
.
timelogs
(
args
[
:start_time
],
args
[
:end_time
])
)
end
def
timelogs_available_for_user?
...
...
ee/app/graphql/types/timelog_type.rb
View file @
4532823f
...
...
@@ -34,5 +34,10 @@ module Types
null:
true
,
resolve:
->
(
obj
,
_args
,
_ctx
)
{
Gitlab
::
Graphql
::
Loaders
::
BatchModelLoader
.
new
(
Issue
,
obj
.
issue_id
).
find
},
description:
'The issue that logged time was added to'
field
:note
,
Types
::
Notes
::
NoteType
,
null:
true
,
description:
'The note where the quick action to add the logged time was executed'
end
end
ee/spec/graphql/types/timelog_type_spec.rb
View file @
4532823f
...
...
@@ -3,7 +3,7 @@
require
'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'Timelog'
]
do
let
(
:fields
)
{
%i[date spent_at time_spent user issue]
}
let
(
:fields
)
{
%i[date spent_at time_spent user issue
note
]
}
it
{
expect
(
described_class
.
graphql_name
).
to
eq
(
'Timelog'
)
}
it
{
expect
(
described_class
).
to
have_graphql_fields
(
fields
)
}
...
...
@@ -24,4 +24,12 @@ RSpec.describe GitlabSchema.types['Timelog'] do
is_expected
.
to
have_graphql_type
(
Types
::
IssueType
)
end
end
describe
'note field'
do
subject
{
described_class
.
fields
[
'note'
]
}
it
'returns note'
do
is_expected
.
to
have_graphql_type
(
Types
::
Notes
::
NoteType
)
end
end
end
spec/lib/gitlab/import_export/all_models.yml
View file @
4532823f
...
...
@@ -539,6 +539,7 @@ timelogs:
-
issue
-
merge_request
-
user
-
note
push_event_payload
:
-
event
issue_assignees
:
...
...
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