summaryrefslogtreecommitdiff
path: root/app/graphql/resolvers/todo_resolver.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/resolvers/todo_resolver.rb')
-rw-r--r--app/graphql/resolvers/todo_resolver.rb50
1 files changed, 6 insertions, 44 deletions
diff --git a/app/graphql/resolvers/todo_resolver.rb b/app/graphql/resolvers/todo_resolver.rb
index 38a4539f34a..cff65321dc0 100644
--- a/app/graphql/resolvers/todo_resolver.rb
+++ b/app/graphql/resolvers/todo_resolver.rb
@@ -38,53 +38,15 @@ module Resolvers
private
- # TODO: Support multiple queries for e.g. state and type on TodosFinder:
- #
- # https://gitlab.com/gitlab-org/gitlab/merge_requests/18487
- # https://gitlab.com/gitlab-org/gitlab/merge_requests/18518
- #
- # As soon as these MR's are merged, we can refactor this to query by
- # multiple contents.
- #
def todo_finder_params(args)
{
- state: first_state(args),
- type: first_type(args),
- group_id: first_group_id(args),
- author_id: first_author_id(args),
- action_id: first_action(args),
- project_id: first_project(args)
+ state: args[:state],
+ type: args[:type],
+ group_id: args[:group_id],
+ author_id: args[:author_id],
+ action_id: args[:action],
+ project_id: args[:project_id]
}
end
-
- def first_project(args)
- first_query_field(args, :project_id)
- end
-
- def first_action(args)
- first_query_field(args, :action)
- end
-
- def first_author_id(args)
- first_query_field(args, :author_id)
- end
-
- def first_group_id(args)
- first_query_field(args, :group_id)
- end
-
- def first_state(args)
- first_query_field(args, :state)
- end
-
- def first_type(args)
- first_query_field(args, :type)
- end
-
- def first_query_field(query, field)
- return unless query.key?(field)
-
- query[field].first if query[field].respond_to?(:first)
- end
end
end