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/todos/restore_many.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/graphql/mutations/todos/restore_many.rb')
-rw-r--r-- | app/graphql/mutations/todos/restore_many.rb | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/app/graphql/mutations/todos/restore_many.rb b/app/graphql/mutations/todos/restore_many.rb index c5e2750768c..ea5f5414134 100644 --- a/app/graphql/mutations/todos/restore_many.rb +++ b/app/graphql/mutations/todos/restore_many.rb @@ -8,7 +8,7 @@ module Mutations MAX_UPDATE_AMOUNT = 50 argument :ids, - [GraphQL::ID_TYPE], + [::Types::GlobalIDType[::Todo]], required: true, description: 'The global ids of the todos to restore (a maximum of 50 is supported at once)' @@ -37,24 +37,18 @@ module Mutations private def gids_of(ids) - ids.map { |id| ::URI::GID.build(app: GlobalID.app, model_name: Todo.name, model_id: id, params: nil).to_s } + ids.map { |id| Gitlab::GlobalId.as_global_id(id, model_name: Todo.name).to_s } end def model_ids_of(ids) ids.map do |gid| - parsed_gid = ::URI::GID.parse(gid) - parsed_gid.model_id.to_i if accessible_todo?(parsed_gid) + # TODO: remove this line when the compatibility layer is removed + # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 + gid = ::Types::GlobalIDType[::Todo].coerce_isolated_input(gid) + gid.model_id.to_i end.compact end - def accessible_todo?(gid) - gid.app == GlobalID.app && todo?(gid) - end - - def todo?(gid) - GlobalID.parse(gid)&.model_class&.ancestors&.include?(Todo) - end - def raise_too_many_todos_requested_error raise Gitlab::Graphql::Errors::ArgumentError, 'Too many todos requested.' end |