diff --git a/app/finders/base_finder.rb b/app/finders/issuable_finder.rb similarity index 97% rename from app/finders/base_finder.rb rename to app/finders/issuable_finder.rb index ec5f5919d7e21..56c4f22120dd8 100644 --- a/app/finders/base_finder.rb +++ b/app/finders/issuable_finder.rb @@ -1,4 +1,4 @@ -# 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) diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index 8e0c606249e2a..20a2b0ce8f0db 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -15,7 +15,7 @@ # label_name: string # sort: string # -class IssuesFinder < BaseFinder +class IssuesFinder < IssuableFinder def klass Issue end diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb index 3727149c8fb4c..b258216d0d4b5 100644 --- a/app/finders/merge_requests_finder.rb +++ b/app/finders/merge_requests_finder.rb @@ -15,7 +15,7 @@ # label_name: string # sort: string # -class MergeRequestsFinder < BaseFinder +class MergeRequestsFinder < IssuableFinder def klass MergeRequest end diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 299fd7e239950..043ce04d321b6 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -6,9 +6,9 @@ class Issues < Grape::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