Commit bd488bc2 authored by Stan Hu's avatar Stan Hu

Merge branch '56332-exclude-public-group-milestones-from-count' into 'master'

Exclude public group milestones from counts in milestones dashboard

Closes #56332

See merge request gitlab-org/gitlab-ce!25230
parents c34c50e1 0f0bf2a2
...@@ -25,8 +25,6 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController ...@@ -25,8 +25,6 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
private private
def group_milestones def group_milestones
groups = GroupsFinder.new(current_user, all_available: false).execute
DashboardGroupMilestone.build_collection(groups, params) DashboardGroupMilestone.build_collection(groups, params)
end end
...@@ -45,6 +43,6 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController ...@@ -45,6 +43,6 @@ class Dashboard::MilestonesController < Dashboard::ApplicationController
end end
def groups def groups
@groups ||= GroupsFinder.new(current_user, state_all: true).execute @groups ||= GroupsFinder.new(current_user, all_available: false).execute
end end
end end
---
title: Fix counts in milestones dashboard
merge_request: 25230
author:
type: fixed
...@@ -3,11 +3,9 @@ require 'spec_helper' ...@@ -3,11 +3,9 @@ require 'spec_helper'
describe Dashboard::MilestonesController do describe Dashboard::MilestonesController do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:public_group) { create(:group, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project_milestone) { create(:milestone, project: project) } let(:project_milestone) { create(:milestone, project: project) }
let(:group_milestone) { create(:milestone, group: group) } let(:group_milestone) { create(:milestone, group: group) }
let!(:public_milestone) { create(:milestone, group: public_group) }
let(:milestone) do let(:milestone) do
DashboardMilestone.build( DashboardMilestone.build(
[project], [project],
...@@ -45,6 +43,9 @@ describe Dashboard::MilestonesController do ...@@ -45,6 +43,9 @@ describe Dashboard::MilestonesController do
end end
describe "#index" do describe "#index" do
let(:public_group) { create(:group, :public) }
let!(:public_milestone) { create(:milestone, group: public_group) }
render_views render_views
it 'returns group and project milestones to which the user belongs' do it 'returns group and project milestones to which the user belongs' do
...@@ -74,10 +75,10 @@ describe Dashboard::MilestonesController do ...@@ -74,10 +75,10 @@ describe Dashboard::MilestonesController do
expect(response.body).not_to include(project_milestone.title) expect(response.body).not_to include(project_milestone.title)
end end
it 'should contain group and project milestones to which the user belongs to' do it 'should show counts of group and project milestones to which the user belongs to' do
get :index get :index
expect(response.body).to include("Open\n<span class=\"badge badge-pill\">3</span>") expect(response.body).to include("Open\n<span class=\"badge badge-pill\">2</span>")
expect(response.body).to include("Closed\n<span class=\"badge badge-pill\">0</span>") expect(response.body).to include("Closed\n<span class=\"badge badge-pill\">0</span>")
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment