Class: Types::Notes::DiscussionType

Inherits:
BaseObject
  • Object
show all
Defined in:
app/graphql/types/notes/discussion_type.rb

Constant Summary collapse

DiscussionID =
::Types::GlobalIDType[::Discussion]

Instance Method Summary collapse

Methods inherited from BaseObject

accepts, assignable?, authorization, authorize, authorized?, #current_user, #id

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Instance Method Details

#noteableObject



32
33
34
35
36
37
38
# File 'app/graphql/types/notes/discussion_type.rb', line 32

def noteable
  noteable = object.noteable

  return unless Ability.allowed?(context[:current_user], :"read_#{noteable.to_ability_name}", noteable)

  noteable
end

#reply_idObject

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`.



28
29
30
# File 'app/graphql/types/notes/discussion_type.rb', line 28

def reply_id
  ::Gitlab::GlobalId.build(object, id: object.reply_id)
end