summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/notes/create/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/notes/create/base.rb')
-rw-r--r--app/graphql/mutations/notes/create/base.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/graphql/mutations/notes/create/base.rb b/app/graphql/mutations/notes/create/base.rb
index f081eac368e..3cfdaf84760 100644
--- a/app/graphql/mutations/notes/create/base.rb
+++ b/app/graphql/mutations/notes/create/base.rb
@@ -9,7 +9,7 @@ module Mutations
authorize :create_note
argument :noteable_id,
- GraphQL::ID_TYPE,
+ ::Types::GlobalIDType[::Noteable],
required: true,
description: 'The global id of the resource to add a note to'
@@ -26,8 +26,6 @@ module Mutations
def resolve(args)
noteable = authorized_find!(id: args[:noteable_id])
- check_object_is_noteable!(noteable)
-
note = ::Notes::CreateService.new(
noteable.project,
current_user,
@@ -42,6 +40,13 @@ module Mutations
private
+ def find_object(id:)
+ # TODO: remove explicit coercion once compatibility layer has been removed
+ # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
+ id = ::Types::GlobalIDType[::Noteable].coerce_isolated_input(id)
+ GitlabSchema.find_by_gid(id)
+ end
+
def create_note_params(noteable, args)
{
noteable: noteable,