diff options
Diffstat (limited to 'app/graphql/mutations/notes/base.rb')
-rw-r--r-- | app/graphql/mutations/notes/base.rb | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/app/graphql/mutations/notes/base.rb b/app/graphql/mutations/notes/base.rb index 31dabc0a660..f2678211335 100644 --- a/app/graphql/mutations/notes/base.rb +++ b/app/graphql/mutations/notes/base.rb @@ -11,21 +11,10 @@ module Mutations private def find_object(id:) - GitlabSchema.object_from_id(id) - end - - def check_object_is_noteable!(object) - unless object.is_a?(Noteable) - raise Gitlab::Graphql::Errors::ResourceNotAvailable, - 'Cannot add notes to this resource' - end - end - - def check_object_is_note!(object) - unless object.is_a?(Note) - raise Gitlab::Graphql::Errors::ResourceNotAvailable, - 'Resource is not a note' - end + # TODO: remove explicit coercion once compatibility layer has been removed + # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 + id = ::Types::GlobalIDType[::Note].coerce_isolated_input(id) + GitlabSchema.find_by_gid(id) end end end |