diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /app/graphql/mutations/notes/base.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
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 |