diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-25 09:45:53 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-12-25 09:45:53 +0200 |
commit | 1e64333c5fe81a36373f0d437e425e8cab107a91 (patch) | |
tree | 1c22053446399cd513c420a30fe5365244dda305 /app/controllers/dashboard_controller.rb | |
parent | 1a2e11c891ef4a2a87b84f2b0b36316bb809ff14 (diff) | |
download | gitlab-ce-1e64333c5fe81a36373f0d437e425e8cab107a91.tar.gz |
Refactor FilterContext
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/dashboard_controller.rb')
-rw-r--r-- | app/controllers/dashboard_controller.rb | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 70dd3fff9a0..78456995b3b 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -51,30 +51,12 @@ class DashboardController < ApplicationController end def merge_requests - @merge_requests = case params[:scope] - when 'authored' then - current_user.merge_requests - when 'all' then - MergeRequest.where(target_project_id: current_user.authorized_projects.pluck(:id)) - else - current_user.assigned_merge_requests - end - - @merge_requests = FilterContext.new(@merge_requests, params).execute + @merge_requests = FilterContext.new(MergeRequest, current_user, params).execute @merge_requests = @merge_requests.recent.page(params[:page]).per(20) end def issues - @issues = case params[:scope] - when 'authored' then - current_user.issues - when 'all' then - Issue.where(project_id: current_user.authorized_projects.pluck(:id)) - else - current_user.assigned_issues - end - - @issues = FilterContext.new(@issues, params).execute + @issues = FilterContext.new(Issue, current_user, params).execute @issues = @issues.recent.page(params[:page]).per(20) @issues = @issues.includes(:author, :project) |