Remove under-used growth tab (#11495)

This commit is contained in:
Ben Halpern 2020-11-19 10:53:36 -05:00 committed by GitHub
parent 77a35b378f
commit c837834d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 94 deletions

View file

@ -1,5 +0,0 @@
module Admin
class GrowthController < Admin::ApplicationController
layout "admin"
end
end

View file

@ -14,7 +14,6 @@ module AdminHelper
{ name: "config", controller: "config" },
{ name: "display_ads", controller: "display_ads" },
{ name: "events", controller: "events" },
{ name: "growth", controller: "growth" },
{ name: "html_variants", controller: "html_variants" },
{ name: "listings", controller: "listings" },
{ name: "moderator_actions", controller: "moderator_actions" },

View file

@ -1,7 +0,0 @@
class Growth < ApplicationRecord
# This class exists to take advantage of Rolify for limiting authorization
# on internal reports.
# NOTE: It is not backed by a database table and should not be expected to
# function like a traditional Rails model
resourcify
end

View file

@ -1,19 +0,0 @@
<div class="crayons-card mb-6 p-6">
<h4 class="mb-4">Past <%= num_days %> day new users (<%= User.where("registered_at > ?", num_days.day.ago).count %>)</h4>
<div class="card">
<div class="card-header">
<strong>Overall data:</strong>
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">
Average comments: <%= User.where("registered_at > ?", num_days.day.ago).average(:comments_count) %>
</li>
<li class="list-group-item">
Average articles: <%= User.where("registered_at > ?", num_days.day.ago).average(:articles_count) %>
</li>
<li class="list-group-item">
Average reactions: <%= User.where("registered_at > ?", num_days.day.ago).average(:reactions_count) %>
</li>
</ul>
</div>
</div>

View file

@ -1,5 +0,0 @@
<h2 class="crayons-title mb-6">Onboarding</h2>
<%= render "results", num_days: 7 %>
<%= render "results", num_days: 1 %>

View file

@ -1,57 +0,0 @@
require "rails_helper"
RSpec.describe "/admin/growth", type: :request do
context "when the user is not an admin" do
let(:user) { create(:user) }
before do
sign_in user
end
it "blocks the request" do
expect do
get "/admin/growth"
end.to raise_error(Pundit::NotAuthorizedError)
end
end
context "when the user is a super admin" do
let(:super_admin) { create(:user, :super_admin) }
before do
sign_in super_admin
get "/admin/growth"
end
it "allows the request" do
expect(response).to have_http_status(:ok)
end
end
context "when the user is a single resource admin" do
let(:single_resource_admin) { create(:user, :single_resource_admin, resource: Growth) }
before do
sign_in single_resource_admin
get "/admin/growth"
end
it "allows the request" do
expect(response).to have_http_status(:ok)
end
end
context "when the user is the wrong single resource admin" do
let(:single_resource_admin) { create(:user, :single_resource_admin, resource: Article) }
before do
sign_in single_resource_admin
end
it "blocks the request" do
expect do
get "/admin/growth"
end.to raise_error(Pundit::NotAuthorizedError)
end
end
end