2012-07-20 07:39:34 +02:00
|
|
|
class MergeRequestsLoad < BaseContext
|
|
|
|
def execute
|
2012-09-02 18:31:16 +02:00
|
|
|
type = params[:f]
|
2012-07-20 07:39:34 +02:00
|
|
|
|
|
|
|
merge_requests = project.merge_requests
|
|
|
|
|
|
|
|
merge_requests = case type
|
2012-09-02 18:31:16 +02:00
|
|
|
when 'all' then merge_requests
|
|
|
|
when 'closed' then merge_requests.closed
|
|
|
|
when 'assigned-to-me' then merge_requests.opened.assigned(current_user)
|
2012-07-20 07:39:34 +02:00
|
|
|
else merge_requests.opened
|
|
|
|
end.page(params[:page]).per(20)
|
|
|
|
|
|
|
|
merge_requests.includes(:author, :project).order("closed, created_at desc")
|
|
|
|
end
|
|
|
|
end
|