Commit 20c2e902 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor finders. Prevent circular dependency error

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 9ccef9a7
# BaseFinder
# IssuableFinder
#
# Used to filter Issues and MergeRequests collections by set of params
#
......@@ -16,7 +16,9 @@
# label_name: string
# sort: string
#
class BaseFinder
require_relative 'projects_finder'
class IssuableFinder
attr_accessor :current_user, :params
def execute(current_user, params)
......
......@@ -15,7 +15,7 @@
# label_name: string
# sort: string
#
class IssuesFinder < BaseFinder
class IssuesFinder < IssuableFinder
def klass
Issue
end
......
......@@ -15,7 +15,7 @@
# label_name: string
# sort: string
#
class MergeRequestsFinder < BaseFinder
class MergeRequestsFinder < IssuableFinder
def klass
MergeRequest
end
......
......@@ -6,9 +6,9 @@ module API
helpers do
def filter_issues_state(issues, state = nil)
case state
when 'opened' then issues.opened
when 'closed' then issues.closed
else issues
when 'opened' then issues.opened
when 'closed' then issues.closed
else issues
end
end
end
......
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