Remove under-used growth tab (#11495)
This commit is contained in:
parent
77a35b378f
commit
c837834d6a
6 changed files with 0 additions and 94 deletions
|
|
@ -1,5 +0,0 @@
|
|||
module Admin
|
||||
class GrowthController < Admin::ApplicationController
|
||||
layout "admin"
|
||||
end
|
||||
end
|
||||
|
|
@ -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" },
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<h2 class="crayons-title mb-6">Onboarding</h2>
|
||||
|
||||
<%= render "results", num_days: 7 %>
|
||||
|
||||
<%= render "results", num_days: 1 %>
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue