diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index cbc8c336bea642679714acbb82e7c7cbb4bf373c..d93eac407b77b52cdc27d53f401c772736fa802f 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -14,17 +14,11 @@ module DashboardHelper end def entities_per_project(project, entity) - items = project.items_for(entity) - - items = case params[:status] - when 'closed' - items.closed - when 'all' - items - else - items.opened - end - - items.cared(current_user).count + case entity.to_sym + when :issue then @issues.where(project_id: project.id) + when :merge_request then @merge_requests.where(target_project_id: project.id) + else + [] + end.count end end diff --git a/app/views/shared/_filter.html.haml b/app/views/shared/_filter.html.haml index d48a8d6c1ddc4682222a52441ed74be28db5bcfb..13bda305d77f117ab86a0ce8d37e6f555c9d065e 100644 --- a/app/views/shared/_filter.html.haml +++ b/app/views/shared/_filter.html.haml @@ -6,7 +6,7 @@ Assigned to me %li{class: ("active" if params[:scope] == 'authored')} = link_to filter_path(entity, scope: 'authored') do - Authored by me + Created by me %li{class: ("active" if params[:scope] == 'all')} = link_to filter_path(entity, scope: 'all') do All diff --git a/features/steps/dashboard/dashboard_issues.rb b/features/steps/dashboard/dashboard_issues.rb index 47d83f73ed28a60d495b80edcf970adff58c182d..9d486bd81568be0ee4b15e9bd51fa62aa2559c6f 100644 --- a/features/steps/dashboard/dashboard_issues.rb +++ b/features/steps/dashboard/dashboard_issues.rb @@ -34,7 +34,7 @@ class DashboardIssues < Spinach::FeatureSteps step 'I click "Authored by me" link' do within ".scope-filter" do - click_link 'Authored by me' + click_link 'Created by me' end end diff --git a/features/steps/dashboard/dashboard_merge_requests.rb b/features/steps/dashboard/dashboard_merge_requests.rb index 3c35462a8db8a26203522bfe0a4bffa39f2588da..f6fe47470b36582653fb9bab7d8984ed50e98f94 100644 --- a/features/steps/dashboard/dashboard_merge_requests.rb +++ b/features/steps/dashboard/dashboard_merge_requests.rb @@ -34,7 +34,7 @@ class DashboardMergeRequests < Spinach::FeatureSteps step 'I click "Authored by me" link' do within ".scope-filter" do - click_link 'Authored by me' + click_link 'Created by me' end end