gitlab-org--gitlab-foss/app/finders/merge_requests_finder.rb
Jacopo 4d26ab28a9 Fix Archived project merge requests add to group's Merge Requests
counter

This is done by:
 - Extending the IssuableFinder adding the non_archived option to the params
 - Overriding the #filter_params in the MergeRequestsAction
 - Passing the non_archived param in the nav/_group.html.haml navbar
   partial from the groups/merge_requests.html.haml
2016-12-05 18:06:36 +01:00

33 lines
727 B
Ruby

# Finders::MergeRequest class
#
# Used to filter MergeRequests collections by set of params
#
# Arguments:
# current_user - which user use
# params:
# scope: 'created-by-me' or 'assigned-to-me' or 'all'
# state: 'open' or 'closed' or 'all'
# group_id: integer
# project_id: integer
# milestone_id: integer
# assignee_id: integer
# search: string
# label_name: string
# sort: string
# non_archived: boolean
#
class MergeRequestsFinder < IssuableFinder
def klass
MergeRequest
end
private
def iid_pattern
@iid_pattern ||= %r{\A[
#{Regexp.escape(MergeRequest.reference_prefix)}
#{Regexp.escape(Issue.reference_prefix)}
](?<iid>\d+)\z
}x
end
end