diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /app/graphql/types/todo_type.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'app/graphql/types/todo_type.rb')
-rw-r--r-- | app/graphql/types/todo_type.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/app/graphql/types/todo_type.rb b/app/graphql/types/todo_type.rb index 4f21da3d897..3694980ef93 100644 --- a/app/graphql/types/todo_type.rb +++ b/app/graphql/types/todo_type.rb @@ -16,19 +16,16 @@ module Types field :project, Types::ProjectType, description: 'The project this todo is associated with', null: true, - authorize: :read_project, - resolve: -> (todo, args, context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, todo.project_id).find } + authorize: :read_project field :group, Types::GroupType, description: 'Group this todo is associated with', null: true, - authorize: :read_group, - resolve: -> (todo, args, context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, todo.group_id).find } + authorize: :read_group field :author, Types::UserType, description: 'The author of this todo', - null: false, - resolve: -> (todo, args, context) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, todo.author_id).find } + null: false field :action, Types::TodoActionEnum, description: 'Action of the todo', @@ -50,5 +47,17 @@ module Types field :created_at, Types::TimeType, description: 'Timestamp this todo was created', null: false + + def project + Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find + end + + def group + Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, object.group_id).find + end + + def author + Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.author_id).find + end end end |