Commit f5da5e70 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Refactor GroupIssuableResolver module

Adds the arguments when included since these are expected to be always
present for group issuables
parent a7fde3da
......@@ -3,19 +3,21 @@
module GroupIssuableResolver
extend ActiveSupport::Concern
class_methods do
def include_subgroups(name_of_things)
argument :include_subgroups, GraphQL::Types::Boolean,
required: false,
default_value: false,
description: "Include #{name_of_things} belonging to subgroups"
end
included do
argument :include_subgroups, GraphQL::Types::Boolean,
required: false,
default_value: false,
description: "Include #{issuable_collection_name} belonging to subgroups"
def non_archived(name_of_things)
argument :non_archived, GraphQL::Types::Boolean,
required: false,
default_value: true,
description: "Return #{name_of_things} from non archived projects"
end
argument :non_archived, GraphQL::Types::Boolean,
required: false,
default_value: true,
description: "Return #{issuable_collection_name} from non archived projects"
end
def resolve(**args)
args[:non_archived] = !args.delete(:include_archived)
super
end
end
......@@ -3,10 +3,11 @@
module Resolvers
class GroupIssuesResolver < BaseIssuesResolver
include GroupIssuableResolver
def self.issuable_collection_name
'issues'
end
include_subgroups 'issues'
non_archived 'issues'
include GroupIssuableResolver
def ready?(**args)
if args.dig(:not, :release_tag).present?
......
......@@ -2,14 +2,16 @@
module Resolvers
class GroupMergeRequestsResolver < MergeRequestsResolver
def self.issuable_collection_name
'merge requests'
end
include GroupIssuableResolver
alias_method :group, :object
type Types::MergeRequestType.connection_type, null: true
include_subgroups 'merge requests'
non_archived 'merge requests'
accept_assignee
accept_author
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment