diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 03:07:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 03:07:33 +0300 |
commit | 6af29c941af34330dd4f9ed9c513823d8067243b (patch) | |
tree | 951285a5149a57207a5a28f1be89d3d56a4e16c1 /app | |
parent | 8a04ac238cdbe9aa804c5f145207baa67403eadd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/graphql/resolvers/echo_resolver.rb | 4 | ||||
-rw-r--r-- | app/graphql/resolvers/issues_resolver.rb | 13 | ||||
-rw-r--r-- | app/graphql/types/diff_refs_type.rb | 9 | ||||
-rw-r--r-- | app/graphql/types/notes/diff_position_type.rb | 24 | ||||
-rw-r--r-- | app/graphql/types/notes/discussion_type.rb | 12 | ||||
-rw-r--r-- | app/graphql/types/notes/note_type.rb | 32 | ||||
-rw-r--r-- | app/graphql/types/query_type.rb | 4 |
7 files changed, 60 insertions, 38 deletions
diff --git a/app/graphql/resolvers/echo_resolver.rb b/app/graphql/resolvers/echo_resolver.rb index 2ce55544254..fe0b1893a23 100644 --- a/app/graphql/resolvers/echo_resolver.rb +++ b/app/graphql/resolvers/echo_resolver.rb @@ -2,9 +2,11 @@ module Resolvers class EchoResolver < BaseResolver - argument :text, GraphQL::STRING_TYPE, required: true # rubocop:disable Graphql/Descriptions description 'Testing endpoint to validate the API with' + argument :text, GraphQL::STRING_TYPE, required: true, + description: 'Text to echo back' + def resolve(**args) username = context[:current_user]&.username diff --git a/app/graphql/resolvers/issues_resolver.rb b/app/graphql/resolvers/issues_resolver.rb index 0ecf5f50e86..664e0955535 100644 --- a/app/graphql/resolvers/issues_resolver.rb +++ b/app/graphql/resolvers/issues_resolver.rb @@ -4,17 +4,17 @@ module Resolvers class IssuesResolver < BaseResolver argument :iid, GraphQL::STRING_TYPE, required: false, - description: 'The IID of the issue, e.g., "1"' + description: 'IID of the issue. For example, "1"' argument :iids, [GraphQL::STRING_TYPE], required: false, - description: 'The list of IIDs of issues, e.g., [1, 2]' + description: 'List of IIDs of issues. For example, [1, 2]' argument :state, Types::IssuableStateEnum, required: false, - description: 'Current state of Issue' + description: 'Current state of this issue' argument :label_name, GraphQL::STRING_TYPE.to_list_type, required: false, - description: 'Labels applied to the Issue' + description: 'Labels applied to this issue' argument :created_before, Types::TimeType, required: false, description: 'Issues created before this date' @@ -33,8 +33,9 @@ module Resolvers argument :closed_after, Types::TimeType, required: false, description: 'Issues closed after this date' - argument :search, GraphQL::STRING_TYPE, # rubocop:disable Graphql/Descriptions - required: false + argument :search, GraphQL::STRING_TYPE, + required: false, + description: 'Search query for finding issues by title or description' argument :sort, Types::IssueSortEnum, description: 'Sort issues by this criteria', required: false, diff --git a/app/graphql/types/diff_refs_type.rb b/app/graphql/types/diff_refs_type.rb index 33a5780cd68..03d080d784b 100644 --- a/app/graphql/types/diff_refs_type.rb +++ b/app/graphql/types/diff_refs_type.rb @@ -6,9 +6,12 @@ module Types class DiffRefsType < BaseObject graphql_name 'DiffRefs' - field :head_sha, GraphQL::STRING_TYPE, null: false, description: 'The sha of the head at the time the comment was made' - field :base_sha, GraphQL::STRING_TYPE, null: false, description: 'The merge base of the branch the comment was made on' - field :start_sha, GraphQL::STRING_TYPE, null: false, description: 'The sha of the branch being compared against' + field :head_sha, GraphQL::STRING_TYPE, null: false, + description: 'SHA of the HEAD at the time the comment was made' + field :base_sha, GraphQL::STRING_TYPE, null: false, + description: 'Merge base of the branch the comment was made on' + field :start_sha, GraphQL::STRING_TYPE, null: false, + description: 'SHA of the branch being compared against' end # rubocop: enable Graphql/AuthorizeTypes end diff --git a/app/graphql/types/notes/diff_position_type.rb b/app/graphql/types/notes/diff_position_type.rb index cab8c750dc0..654562da0a7 100644 --- a/app/graphql/types/notes/diff_position_type.rb +++ b/app/graphql/types/notes/diff_position_type.rb @@ -7,36 +7,38 @@ module Types class DiffPositionType < BaseObject graphql_name 'DiffPosition' - field :diff_refs, Types::DiffRefsType, null: false # rubocop:disable Graphql/Descriptions + field :diff_refs, Types::DiffRefsType, null: false, + description: 'Information about the branch, HEAD, and base at the time of commenting' field :file_path, GraphQL::STRING_TYPE, null: false, - description: "The path of the file that was changed" + description: 'Path of the file that was changed' field :old_path, GraphQL::STRING_TYPE, null: true, - description: "The path of the file on the start sha." + description: 'Path of the file on the start SHA' field :new_path, GraphQL::STRING_TYPE, null: true, - description: "The path of the file on the head sha." - field :position_type, Types::Notes::PositionTypeEnum, null: false # rubocop:disable Graphql/Descriptions + description: 'Path of the file on the HEAD SHA' + field :position_type, Types::Notes::PositionTypeEnum, null: false, + description: 'Type of file the position refers to' # Fields for text positions field :old_line, GraphQL::INT_TYPE, null: true, - description: "The line on start sha that was changed", + description: 'Line on start SHA that was changed', resolve: -> (position, _args, _ctx) { position.old_line if position.on_text? } field :new_line, GraphQL::INT_TYPE, null: true, - description: "The line on head sha that was changed", + description: 'Line on HEAD SHA that was changed', resolve: -> (position, _args, _ctx) { position.new_line if position.on_text? } # Fields for image positions field :x, GraphQL::INT_TYPE, null: true, - description: "The X postion on which the comment was made", + description: 'X position on which the comment was made', resolve: -> (position, _args, _ctx) { position.x if position.on_image? } field :y, GraphQL::INT_TYPE, null: true, - description: "The Y position on which the comment was made", + description: 'Y position on which the comment was made', resolve: -> (position, _args, _ctx) { position.y if position.on_image? } field :width, GraphQL::INT_TYPE, null: true, - description: "The total width of the image", + description: 'Total width of the image', resolve: -> (position, _args, _ctx) { position.width if position.on_image? } field :height, GraphQL::INT_TYPE, null: true, - description: "The total height of the image", + description: 'Total height of the image', resolve: -> (position, _args, _ctx) { position.height if position.on_image? } end # rubocop: enable Graphql/AuthorizeTypes diff --git a/app/graphql/types/notes/discussion_type.rb b/app/graphql/types/notes/discussion_type.rb index ab87f8280ac..74a233e9d26 100644 --- a/app/graphql/types/notes/discussion_type.rb +++ b/app/graphql/types/notes/discussion_type.rb @@ -7,10 +7,14 @@ module Types authorize :read_note - field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions - field :reply_id, GraphQL::ID_TYPE, null: false, description: 'The ID used to reply to this discussion' - field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions - field :notes, Types::Notes::NoteType.connection_type, null: false, description: "All notes in the discussion" + field :id, GraphQL::ID_TYPE, null: false, + description: "ID of this discussion" + field :reply_id, GraphQL::ID_TYPE, null: false, + description: 'ID used to reply to this discussion' + field :created_at, Types::TimeType, null: false, + description: "Timestamp of the discussion's creation" + field :notes, Types::Notes::NoteType.connection_type, null: false, + description: 'All notes in the discussion' # The gem we use to generate Global IDs is hard-coded to work with # `id` properties. To generate a GID for the `reply_id` property, diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index 4edf6ed90f7..b60fc96bd03 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -9,40 +9,48 @@ module Types expose_permissions Types::PermissionTypes::Note - field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions + field :id, GraphQL::ID_TYPE, null: false, + description: 'ID of the note' field :project, Types::ProjectType, null: true, - description: "The project this note is associated to", + description: 'Project associated with the note', resolve: -> (note, args, context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, note.project_id).find } field :author, Types::UserType, null: false, - description: "The user who wrote this note", + description: 'User who wrote this note', resolve: -> (note, args, context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, note.author_id).find } field :resolved_by, Types::UserType, null: true, - description: "The user that resolved the discussion", + description: 'User that resolved the discussion', resolve: -> (note, _args, _context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, note.resolved_by_id).find } field :system, GraphQL::BOOLEAN_TYPE, null: false, - description: "Whether or not this note was created by the system or by a user" + description: 'Indicates whether this note was created by the system or by a user' field :body, GraphQL::STRING_TYPE, null: false, method: :note, - description: "The content note itself" + description: 'Content of the note' markdown_field :body_html, null: true, method: :note - field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions - field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions - field :discussion, Types::Notes::DiscussionType, null: true, description: "The discussion this note is a part of" - field :resolvable, GraphQL::BOOLEAN_TYPE, null: false, method: :resolvable? # rubocop:disable Graphql/Descriptions - field :resolved_at, Types::TimeType, null: true, description: "The time the discussion was resolved" - field :position, Types::Notes::DiffPositionType, null: true, description: "The position of this note on a diff" + field :created_at, Types::TimeType, null: false, + description: 'Timestamp of the note creation' + field :updated_at, Types::TimeType, null: false, + description: "Timestamp of the note's last activity" + field :discussion, Types::Notes::DiscussionType, null: true, + description: 'The discussion this note is a part of' + field :resolvable, GraphQL::BOOLEAN_TYPE, null: false, + description: 'Indicates if this note can be resolved. That is, if it is a resolvable discussion or simply a standalone note', + method: :resolvable? + field :resolved_at, Types::TimeType, null: true, + description: "Timestamp of the note's resolution" + field :position, Types::Notes::DiffPositionType, null: true, + description: 'The position of this note on a diff' end end end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 06188d99490..199a6226c6d 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -35,6 +35,8 @@ module Types resolver: Resolvers::SnippetsResolver, description: 'Find Snippets visible to the current user' - field :echo, GraphQL::STRING_TYPE, null: false, resolver: Resolvers::EchoResolver # rubocop:disable Graphql/Descriptions + field :echo, GraphQL::STRING_TYPE, null: false, + description: 'Text to echo back', + resolver: Resolvers::EchoResolver end end |