BigW Consortium Gitlab

merge_requests_finder.rb 699 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# 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
#
18
class MergeRequestsFinder < IssuableFinder
19 20 21
  def klass
    MergeRequest
  end
barthc committed
22 23 24 25 26 27 28 29 30 31

  private

  def iid_pattern
    @iid_pattern ||= %r{\A[
      #{Regexp.escape(MergeRequest.reference_prefix)}
      #{Regexp.escape(Issue.reference_prefix)}
      ](?<iid>\d+)\z
    }x
  end
32
end