Commit 7b906e70 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'osw-adjust-burndown-charts-promotion' into 'master'

Stop presenting burndown charts promotion for grouped milestones

Closes gitlab-ce#46129

See merge request gitlab-org/gitlab-ee!5616
parents df349b66 e10170b2
...@@ -10,6 +10,10 @@ module EE ...@@ -10,6 +10,10 @@ module EE
burndown&.valid? && !burndown&.empty? burndown&.valid? && !burndown&.empty?
end end
def show_burndown_charts_promotion?(milestone)
milestone.is_a?(EE::Milestone) && !milestone.supports_burndown_charts? && show_promotions?
end
def show_burndown_placeholder?(milestone, warning) def show_burndown_placeholder?(milestone, warning)
return false if cookies['hide_burndown_message'].present? return false if cookies['hide_burndown_message'].present?
return false unless milestone.supports_burndown_charts? return false unless milestone.supports_burndown_charts?
......
- callout_id = 'promote_burndown_charts_dismissed' - callout_id = 'promote_burndown_charts_dismissed'
- if !milestone.supports_burndown_charts? && show_promotions? && show_callout?(callout_id) - if show_burndown_charts_promotion?(milestone) && show_callout?(callout_id)
.user-callout.promotion-callout#promote_burndown_charts{ data: { uid: callout_id } } .user-callout.promotion-callout#promote_burndown_charts{ data: { uid: callout_id } }
.bordered-box.content-block .bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss burndown charts promotion' } %button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss burndown charts promotion' }
......
---
title: Stop presenting burndown charts promotion for grouped by title milestones
merge_request:
author:
type: fixed
require 'spec_helper'
feature 'Burndown charts' do
let(:current_user) { create(:user) }
let(:milestone) do
create(:milestone, project: project,
group: group,
start_date: Date.current,
due_date: Date.tomorrow)
end
before do
sign_in(current_user)
end
describe 'for project milestones' do
let(:group) { nil }
let(:project) { create(:project) }
before do
project.add_master(current_user)
end
it 'presents burndown charts when available' do
stub_licensed_features(burndown_charts: true)
visit project_milestone_path(milestone.project, milestone)
expect(page).to have_css('.burndown-chart')
expect(page).to have_content('Burndown chart')
end
it 'presents burndown charts promotion correctly' do
stub_licensed_features(burndown_charts: false)
allow(License).to receive(:current) { nil }
visit project_milestone_path(milestone.project, milestone)
expect(page).not_to have_css('.burndown-chart')
expect(page).to have_content('Improve milestones with Burndown Charts')
end
end
describe 'for group milestones' do
let(:group) { create(:group) }
let(:project) { nil }
before do
group.add_master(current_user)
end
it 'presents burndown charts when available' do
stub_licensed_features(group_burndown_charts: true)
visit group_milestone_path(milestone.group, milestone)
expect(page).to have_css('div.burndown-chart')
expect(page).to have_content('Burndown chart')
end
it 'presents burndown charts promotion correctly' do
stub_licensed_features(group_burndown_charts: false)
allow(License).to receive(:current) { nil }
visit group_milestone_path(milestone.group, milestone)
expect(page).not_to have_css('.burndown-chart')
expect(page).to have_content('Improve milestones with Burndown Charts')
end
end
describe 'grouped by title milestones' do
let(:group) { nil }
let(:project) { create(:project) }
before do
project.add_master(current_user)
end
it 'does not present burndown chart or promotion' do
allow(License).to receive(:current) { nil }
allow(Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?) { true }
visit dashboard_milestone_path(milestone.safe_title, title: milestone.title)
expect(page).to have_content('manage issues from multiple projects in the same milestone.')
expect(page).not_to have_css('.burndown-chart')
expect(page).not_to have_content('Improve milestones with Burndown Charts')
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