Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/notes')
-rw-r--r--app/graphql/types/notes/diff_position_type.rb22
-rw-r--r--app/graphql/types/notes/discussion_type.rb20
-rw-r--r--app/graphql/types/notes/note_type.rb26
-rw-r--r--app/graphql/types/notes/noteable_type.rb4
4 files changed, 37 insertions, 35 deletions
diff --git a/app/graphql/types/notes/diff_position_type.rb b/app/graphql/types/notes/diff_position_type.rb
index 13d9be49484..67747a13dcf 100644
--- a/app/graphql/types/notes/diff_position_type.rb
+++ b/app/graphql/types/notes/diff_position_type.rb
@@ -8,32 +8,32 @@ module Types
graphql_name 'DiffPosition'
field :diff_refs, Types::DiffRefsType, null: false,
- description: 'Information about the branch, HEAD, and base at the time of commenting'
+ description: 'Information about the branch, HEAD, and base at the time of commenting.'
field :file_path, GraphQL::STRING_TYPE, null: false,
- description: 'Path of the file that was changed'
+ description: 'Path of the file that was changed.'
field :old_path, GraphQL::STRING_TYPE, null: true,
- description: '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: 'Path of the file on the HEAD SHA'
+ 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'
+ description: 'Type of file the position refers to.'
# Fields for text positions
field :old_line, GraphQL::INT_TYPE, null: true,
- description: 'Line on start SHA that was changed'
+ description: 'Line on start SHA that was changed.'
field :new_line, GraphQL::INT_TYPE, null: true,
- description: 'Line on HEAD SHA that was changed'
+ description: 'Line on HEAD SHA that was changed.'
# Fields for image positions
field :x, GraphQL::INT_TYPE, null: true,
- description: 'X position of the note'
+ description: 'X position of the note.'
field :y, GraphQL::INT_TYPE, null: true,
- description: 'Y position of the note'
+ description: 'Y position of the note.'
field :width, GraphQL::INT_TYPE, null: true,
- description: 'Total width of the image'
+ description: 'Total width of the image.'
field :height, GraphQL::INT_TYPE, null: true,
- description: 'Total height of the image'
+ description: 'Total height of the image.'
def old_line
object.old_line if object.on_text?
diff --git a/app/graphql/types/notes/discussion_type.rb b/app/graphql/types/notes/discussion_type.rb
index a51d253097d..17cb4debd63 100644
--- a/app/graphql/types/notes/discussion_type.rb
+++ b/app/graphql/types/notes/discussion_type.rb
@@ -3,24 +3,26 @@
module Types
module Notes
class DiscussionType < BaseObject
+ DiscussionID = ::Types::GlobalIDType[::Discussion]
+
graphql_name 'Discussion'
authorize :read_note
implements(Types::ResolvableInterface)
- 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 :id, DiscussionID, null: false,
+ description: "ID of this discussion."
+ field :reply_id, DiscussionID, null: false,
+ description: 'ID used to reply to this discussion.'
field :created_at, Types::TimeType, null: false,
- description: "Timestamp of the discussion's creation"
+ description: "Timestamp of the discussion's creation."
field :notes, Types::Notes::NoteType.connection_type, null: false,
- description: 'All notes in the discussion'
+ 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,
- # we must use the ::Gitlab::GlobalId module.
+ # DiscussionID.coerce_result is suitable here, but will always mark this
+ # as being a 'Discussion'. Using `GlobalId.build` guarantees that we get
+ # the correct class, and that it matches `id`.
def reply_id
::Gitlab::GlobalId.build(object, id: object.reply_id)
end
diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb
index 84b61340e93..751cf7c10f1 100644
--- a/app/graphql/types/notes/note_type.rb
+++ b/app/graphql/types/notes/note_type.rb
@@ -11,44 +11,44 @@ module Types
implements(Types::ResolvableInterface)
- field :id, GraphQL::ID_TYPE, null: false,
- description: 'ID of the note'
+ field :id, ::Types::GlobalIDType[::Note], null: false,
+ description: 'ID of the note.'
field :project, Types::ProjectType,
null: true,
- description: 'Project associated with the note'
+ description: 'Project associated with the note.'
field :author, Types::UserType,
null: false,
- description: 'User who wrote this note'
+ description: 'User who wrote this note.'
field :system, GraphQL::BOOLEAN_TYPE,
null: false,
- description: 'Indicates whether 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 :system_note_icon_name, GraphQL::STRING_TYPE, null: true,
- description: 'Name of the icon corresponding to a system note'
+ description: 'Name of the icon corresponding to a system note.'
field :body, GraphQL::STRING_TYPE,
null: false,
method: :note,
- description: 'Content of the note'
+ description: 'Content of the note.'
markdown_field :body_html, null: true, method: :note
field :created_at, Types::TimeType, null: false,
- description: 'Timestamp of the note creation'
+ description: 'Timestamp of the note creation.'
field :updated_at, Types::TimeType, null: false,
- description: "Timestamp of the note's last activity"
+ description: "Timestamp of the note's last activity."
field :discussion, Types::Notes::DiscussionType, null: true,
- description: 'The discussion this note is a part of'
+ description: 'The discussion this note is a part of.'
field :position, Types::Notes::DiffPositionType, null: true,
- description: 'The position of this note on a diff'
+ description: 'The position of this note on a diff.'
field :confidential, GraphQL::BOOLEAN_TYPE, null: true,
- description: 'Indicates if this note is confidential',
+ description: 'Indicates if this note is confidential.',
method: :confidential?
field :url, GraphQL::STRING_TYPE,
null: true,
- description: 'URL to view this Note in the Web UI'
+ description: 'URL to view this Note in the Web UI.'
def url
::Gitlab::UrlBuilder.build(object)
diff --git a/app/graphql/types/notes/noteable_type.rb b/app/graphql/types/notes/noteable_type.rb
index 602634d9292..f8626d249a1 100644
--- a/app/graphql/types/notes/noteable_type.rb
+++ b/app/graphql/types/notes/noteable_type.rb
@@ -5,8 +5,8 @@ module Types
module NoteableType
include Types::BaseInterface
- field :notes, Types::Notes::NoteType.connection_type, null: false, description: "All notes on this noteable"
- field :discussions, Types::Notes::DiscussionType.connection_type, null: false, description: "All discussions on this noteable"
+ field :notes, Types::Notes::NoteType.connection_type, null: false, description: "All notes on this noteable."
+ field :discussions, Types::Notes::DiscussionType.connection_type, null: false, description: "All discussions on this noteable."
def self.resolve_type(object, context)
case object