Skip to content

Commit

Permalink
Revert "Feature flag for data dashboard (#2123)" (#2162)
Browse files Browse the repository at this point in the history
This reverts commit ca41cdc.
  • Loading branch information
caiosba committed Dec 18, 2024
1 parent 0efdb7b commit 4be928c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
1 change: 0 additions & 1 deletion app/graph/types/team_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
end
26 changes: 2 additions & 24 deletions test/controllers/graphql_controller_11_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4be928c

Please sign in to comment.