diff options
author | manojmj <mmj@gitlab.com> | 2019-08-30 19:03:57 +0530 |
---|---|---|
committer | manojmj <mmj@gitlab.com> | 2019-08-31 01:01:18 +0530 |
commit | 9af1cd11d65b5129f780cd9f1da6b38ce58efe78 (patch) | |
tree | 4b0e52e8c5fdb097c9bfa04dda1edc5057f92d1c | |
parent | 69a4490793d29f4bff62029fea5e92cd18ec387d (diff) | |
download | gitlab-ce-test-51123.tar.gz |
Do not add Project, User, Group counts in APItest-51123
-rw-r--r-- | app/controllers/admin/dashboard_controller.rb | 3 | ||||
-rw-r--r-- | lib/api/entities.rb | 12 | ||||
-rw-r--r-- | lib/api/statistics.rb | 2 | ||||
-rw-r--r-- | spec/fixtures/api/schemas/statistics.json | 6 | ||||
-rw-r--r-- | spec/requests/api/statistics_spec.rb | 6 |
5 files changed, 4 insertions, 25 deletions
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 23cc9ee247a..64b959e2431 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -3,8 +3,7 @@ class Admin::DashboardController < Admin::ApplicationController include CountHelper - COUNTED_ITEMS = [Project, User, Group, ForkNetworkMember, ForkNetwork, Issue, - MergeRequest, Note, Snippet, Key, Milestone].freeze + COUNTED_ITEMS = [Project, User, Group].freeze # rubocop: disable CodeReuse/ActiveRecord def index diff --git a/lib/api/entities.rb b/lib/api/entities.rb index e1826a2dd93..a08ff9d3be5 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1199,18 +1199,6 @@ module API approximate_count_with_delimiters(counts, ::Milestone) end - expose :users do |counts| - approximate_count_with_delimiters(counts, ::User) - end - - expose :projects do |counts| - approximate_count_with_delimiters(counts, ::Project) - end - - expose :groups do |counts| - approximate_count_with_delimiters(counts, ::Group) - end - expose :active_users do |_| number_with_delimiter(::User.active.count) end diff --git a/lib/api/statistics.rb b/lib/api/statistics.rb index d2dce34dfa5..032807cb2ac 100644 --- a/lib/api/statistics.rb +++ b/lib/api/statistics.rb @@ -4,7 +4,7 @@ module API class Statistics < Grape::API before { authenticated_as_admin! } - COUNTED_ITEMS = [Project, User, Group, ForkNetworkMember, ForkNetwork, Issue, + COUNTED_ITEMS = [ForkNetworkMember, ForkNetwork, Issue, MergeRequest, Note, Snippet, Key, Milestone].freeze desc 'Get the current application statistics' do diff --git a/spec/fixtures/api/schemas/statistics.json b/spec/fixtures/api/schemas/statistics.json index ef2f39aad9d..63bdd67d442 100644 --- a/spec/fixtures/api/schemas/statistics.json +++ b/spec/fixtures/api/schemas/statistics.json @@ -8,9 +8,6 @@ "snippets", "ssh_keys", "milestones", - "users", - "projects", - "groups", "active_users" ], "properties" : { @@ -21,9 +18,6 @@ "snippets'": { "type": "string" }, "ssh_keys'": { "type": "string" }, "milestones'": { "type": "string" }, - "users'": { "type": "string" }, - "projects'": { "type": "string" }, - "groups'": { "type": "string" }, "active_users'": { "type": "string" } } } diff --git a/spec/requests/api/statistics_spec.rb b/spec/requests/api/statistics_spec.rb index 55184271245..39fa549fc90 100644 --- a/spec/requests/api/statistics_spec.rb +++ b/spec/requests/api/statistics_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe API::Statistics, 'Statistics' do @@ -36,7 +38,6 @@ describe API::Statistics, 'Statistics' do projects = create_list(:project, 4, namespace: create(:namespace, owner: admin)) issues = create_list(:issue, 2, project: projects.first, updated_by: admin) - create_list(:group, 2) create_list(:snippet, 2, :public, author: admin) create_list(:note, 2, author: admin, project: projects.first, noteable: issues.first) create_list(:milestone, 3, project: projects.first) @@ -52,9 +53,6 @@ describe API::Statistics, 'Statistics' do expect(json_response['forks']).to eq('0') expect(json_response['ssh_keys']).to eq('1') expect(json_response['milestones']).to eq('3') - expect(json_response['users']).to eq('1') - expect(json_response['projects']).to eq('4') - expect(json_response['groups']).to eq('2') expect(json_response['active_users']).to eq('1') end end |