diff options
Diffstat (limited to 'app/graphql/types/commit_type.rb')
-rw-r--r-- | app/graphql/types/commit_type.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/graphql/types/commit_type.rb b/app/graphql/types/commit_type.rb index 5dd862c7388..9f83e955f4c 100644 --- a/app/graphql/types/commit_type.rb +++ b/app/graphql/types/commit_type.rb @@ -8,7 +8,7 @@ module Types present_using CommitPresenter - implements(Types::TodoableInterface) + implements Types::TodoableInterface field :id, type: GraphQL::Types::ID, null: false, description: 'ID (global ID) of the commit.' @@ -34,6 +34,9 @@ module Types field :authored_date, type: Types::TimeType, null: true, description: 'Timestamp of when the commit was authored.' + field :committed_date, type: Types::TimeType, null: true, + description: 'Timestamp of when the commit was committed.' + field :web_url, type: GraphQL::Types::String, null: false, description: 'Web URL of the commit.' @@ -55,10 +58,24 @@ module Types field :author_name, type: GraphQL::Types::String, null: true, description: 'Commit authors name.' + field :committer_email, type: GraphQL::Types::String, null: true, + description: "Email of the committer." + + field :committer_name, type: GraphQL::Types::String, null: true, + description: "Name of the committer." + # models/commit lazy loads the author by email field :author, type: Types::UserType, null: true, description: 'Author of the commit.' + field :diffs, [Types::DiffType], null: true, calls_gitaly: true, + description: 'Diffs contained within the commit. ' \ + 'This field can only be resolved for 10 diffs in any single request.' do + # Limited to 10 calls per GraphQL request as calling `diffs` multiple times will + # lead to N+1 queries to Gitaly. + extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 10 + end + field :pipelines, null: true, description: 'Pipelines of the commit ordered latest first.', @@ -68,6 +85,10 @@ module Types markdown_field :full_title_html, null: true markdown_field :description_html, null: true + def diffs + object.diffs.diffs + end + def author_gravatar GravatarService.new.execute(object.author_email, 40) end |