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