Commit addcad9c authored by Aakriti Gupta's avatar Aakriti Gupta Committed by Dmytro Zaporozhets

Make Group Activity Analytics a beta feature

- it will be enbaled per group for beta testing
- finally it can be enabled globally, without
changing this check
parent f90206a9
......@@ -90,8 +90,7 @@ module EE
end
def show_group_activity_analytics?
::Feature.enabled?(:group_activity_analytics, @group) &&
can?(current_user, :read_group_activity_analytics, @group)
can?(current_user, :read_group_activity_analytics, @group)
end
def show_usage_quotas_in_sidebar?
......
......@@ -19,7 +19,7 @@ module EE
end
condition(:group_activity_analytics_available) do
@subject.feature_available?(:group_activity_analytics)
@subject.beta_feature_available?(:group_activity_analytics)
end
condition(:can_owners_manage_ldap, scope: :global) do
......
......@@ -34,9 +34,6 @@ module API
end
get 'issues_count' do
not_found! unless
Feature.enabled?(:group_activity_analytics, group)
authorize! :read_group_activity_analytics, group
present(
......@@ -55,9 +52,6 @@ module API
end
get 'merge_requests_count' do
not_found! unless
Feature.enabled?(:group_activity_analytics, group)
authorize! :read_group_activity_analytics, group
present(
......@@ -76,9 +70,6 @@ module API
end
get 'new_members_count' do
not_found! unless
Feature.enabled?(:group_activity_analytics, group)
authorize! :read_group_activity_analytics, group
present(
......
......@@ -143,7 +143,11 @@ describe GroupsHelper do
describe '#show_group_activity_analytics?' do
before do
allow(Feature).to receive(:enabled?).with(:group_activity_analytics, group).and_return(false)
allow(Feature).to receive(:enabled?).with(:group_activity_analytics).and_return(true)
stub_licensed_features(group_activity_analytics: feature_available)
allow(helper).to receive(:current_user) { current_user }
allow(helper).to receive(:can?) { |*args| Ability.allowed?(*args) }
end
......
......@@ -92,6 +92,8 @@ describe GroupPolicy do
let(:current_user) { developer }
before do
allow(Feature).to receive(:enabled?).with(:group_activity_analytics, group).and_return(false)
stub_licensed_features(group_activity_analytics: true)
end
......@@ -102,6 +104,9 @@ describe GroupPolicy do
let(:current_user) { developer }
before do
allow(Feature).to receive(:enabled?).with(:group_activity_analytics, group).and_return(false)
allow(Feature).to receive(:enabled?).with(:group_activity_analytics).and_return(true)
stub_licensed_features(group_activity_analytics: false)
end
......
......@@ -12,7 +12,9 @@ describe API::Analytics::GroupActivityAnalytics do
let_it_be(:anonymous_user) { create(:user) }
shared_examples 'GET group_activity' do |activity, count|
let(:feature_enabled) { true }
let(:feature_available) { true }
let(:feature_enabled_globally) { true }
let(:feature_enabled_for_group) { true }
let(:params) { { group_path: group.full_path } }
let(:current_user) { reporter }
let(:request) do
......@@ -20,7 +22,11 @@ describe API::Analytics::GroupActivityAnalytics do
end
before do
stub_licensed_features(group_activity_analytics: feature_enabled)
allow(Feature).to receive(:enabled?).with(:group_activity_analytics, group).and_return(feature_enabled_for_group)
allow(Feature).to receive(:enabled?).with(:group_activity_analytics).and_return(feature_enabled_globally)
stub_licensed_features(group_activity_analytics: feature_available)
request
end
......@@ -33,7 +39,17 @@ describe API::Analytics::GroupActivityAnalytics do
end
context 'when feature is not available in plan' do
let(:feature_enabled) { false }
let(:feature_available) { false }
let(:feature_enabled_for_group) { false }
it 'is returns `forbidden`' do
expect(response).to have_gitlab_http_status(:forbidden)
end
end
context 'when feature is disabled globally' do
let(:feature_enabled_globally) { false }
let(:feature_enabled_for_group) { false }
it 'is returns `forbidden`' do
expect(response).to have_gitlab_http_status(:forbidden)
......
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