Commit d29e81b2 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '7048_usage_ping_for_security_dashboard_as_default_view_for_groups-ce' into 'master'

Usage ping for Group overview default user preference

See merge request gitlab-org/gitlab-ce!24980
parents 453dec0a fa518963
......@@ -90,8 +90,14 @@ module Gitlab
todos: count(Todo),
uploads: count(Upload),
web_hooks: count(WebHook)
}.merge(services_usage).merge(approximate_counts)
}
}
.merge(services_usage)
.merge(approximate_counts)
}.tap do |data|
if Feature.enabled?(:group_overview_security_dashboard)
data[:counts][:user_preferences] = user_preferences_usage
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
......@@ -159,6 +165,10 @@ module Gitlab
}
end
def user_preferences_usage
{} # augmented in EE
end
def count(relation, fallback: -1)
relation.count
rescue ActiveRecord::StatementInvalid
......
......@@ -124,9 +124,15 @@ describe Gitlab::UsageData do
todos
uploads
web_hooks
user_preferences
))
end
it 'does not gather user preferences usage data when the feature is disabled' do
stub_feature_flags(group_overview_security_dashboard: false)
expect(subject[:counts].keys).not_to include(:user_preferences)
end
it 'gathers projects data correctly' do
count_data = subject[:counts]
......
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