From 579d742be445dbfacb8e2a025d0510675f0cdc37 Mon Sep 17 00:00:00 2001 From: Caio <117518+caiosba@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:23:06 -0300 Subject: [PATCH] Revert "Feature flag for data dashboard (#2123)" This reverts commit ca41cdcf52fd41a91c2d1b827dc9f4c20781fadd. --- app/graph/types/team_type.rb | 1 - .../controllers/graphql_controller_11_test.rb | 26 ++----------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/app/graph/types/team_type.rb b/app/graph/types/team_type.rb index 3e031b366..01e56ba6d 100644 --- a/app/graph/types/team_type.rb +++ b/app/graph/types/team_type.rb @@ -397,7 +397,6 @@ def api_keys end def statistics(period:, language: nil, platform: nil) - return nil unless User.current&.is_admin TeamStatistics.new(object, period, language, platform) end diff --git a/test/controllers/graphql_controller_11_test.rb b/test/controllers/graphql_controller_11_test.rb index 890868719..a41fa4a00 100644 --- a/test/controllers/graphql_controller_11_test.rb +++ b/test/controllers/graphql_controller_11_test.rb @@ -201,8 +201,8 @@ def teardown end end - test "should get team statistics if super admin" do - user = create_user is_admin: true + test "should get team statistics" do + user = create_user team = create_team create_team_user user: user, team: team, role: 'admin' @@ -244,28 +244,6 @@ def teardown post :create, params: { query: query } assert_response :success - assert_not_nil JSON.parse(@response.body).dig('data', 'team', 'statistics') - end - - test "should not get team statistics if not super admin" do - user = create_user is_admin: false - team = create_team - create_team_user user: user, team: team, role: 'admin' - - authenticate_with_user(user) - query = <<~GRAPHQL - query { - team(slug: "#{team.slug}") { - statistics(period: "past_week", platform: "whatsapp", language: "en") { - number_of_articles_created_by_date - } - } - } - GRAPHQL - - post :create, params: { query: query } - assert_response :success - assert_nil JSON.parse(@response.body).dig('data', 'team', 'statistics') end test "should not get requests if interval is more than one month" do