Commit 03c6b4d9 authored by Nick Thomas's avatar Nick Thomas

Disable burndown charts when issuable weights are unlicensed

parent 8bcb10e3
......@@ -45,7 +45,8 @@ class Projects::MilestonesController < Projects::ApplicationController
end
def show
if @project.feature_available?(:burndown_charts, current_user)
if @project.feature_available?(:burndown_charts, current_user) &&
@project.feature_available?(:issue_weights, current_user)
@burndown = Burndown.new(@milestone)
end
end
......
......@@ -134,14 +134,16 @@ module MilestonesHelper
end
def can_generate_chart?(burndown)
return unless @project.feature_available?(:burndown_charts, current_user)
return unless @project.feature_available?(:burndown_charts, current_user) &&
@project.feature_available?(:issue_weights, current_user)
burndown&.valid? && !burndown&.empty?
end
def show_burndown_placeholder?(warning)
return false if cookies['hide_burndown_message'].present?
return false unless @project.feature_available?(:burndown_charts, current_user)
return false unless @project.feature_available?(:burndown_charts, current_user) &&
@project.feature_available?(:issue_weights, current_user)
warning.nil? && can?(current_user, :admin_milestone, @project)
end
......
......@@ -88,11 +88,7 @@ describe 'Milestones on EE', feature: true do
end
end
context 'with the burndown chart feature disabled' do
before do
stub_licensed_features(burndown_charts: false)
end
shared_examples 'burndown charts disabled' do
it 'has a link to upgrade to Bronze when checking the namespace plan' do
# Not using `stub_application_setting` because the method is prepended in
# `EE::ApplicationSetting` which breaks when using `any_instance`
......@@ -118,6 +114,22 @@ describe 'Milestones on EE', feature: true do
end
end
end
context 'with the burndown chart feature disabled' do
before do
stub_licensed_features(burndown_charts: false)
end
include_examples 'burndown charts disabled'
end
context 'with the issuable weights feature disabled' do
before do
stub_licensed_features(issue_weights: false)
end
include_examples 'burndown charts disabled'
end
end
context 'milestone summary' do
......
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