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