[Dashboard] Remove appeals

There're not used. Also remove flags which weren't even displayed
This commit is contained in:
Earlopain 2021-11-02 14:21:19 +01:00
parent d348a0f303
commit e4280cdd7a
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
6 changed files with 0 additions and 87 deletions

View File

@ -1,7 +1,6 @@
module Moderator
class DashboardsController < ApplicationController
before_action :janitor_only
helper :post_flags, :post_appeals
def show
@dashboard = Moderator::Dashboard::Report.new(params[:min_date] || 2.days.ago.to_date, params[:max_level] || 20)

View File

@ -1,16 +0,0 @@
module Moderator
module Dashboard
module Queries
class PostAppeal
def self.all(min_date)
::Post.joins(:appeals).includes(:uploader, :flags, appeals: [:creator])
.deleted
.where("post_appeals.created_at > ?", min_date)
.group(:id)
.order(Arel.sql("count(*) desc"))
.limit(10)
end
end
end
end
end

View File

@ -1,32 +0,0 @@
module Moderator
module Dashboard
module Queries
class PostFlag
attr_reader :post, :count
def self.all(min_date)
sql = <<-EOS
SELECT post_flags.post_id, count(*)
FROM post_flags
JOIN posts ON posts.id = post_flags.post_id
WHERE
post_flags.created_at > ?
AND post_flags.reason <> ?
AND posts.is_deleted = false
and posts.is_pending = false
GROUP BY post_flags.post_id
ORDER BY count(*) DESC
LIMIT 10
EOS
ActiveRecord::Base.select_all_sql(sql, min_date, "Unapproved in 30 days").map {|x| new(x)}
end
def initialize(hash)
@post = Post.find(hash["post_id"])
@count = hash["count"]
end
end
end
end
end

View File

@ -32,18 +32,6 @@ module Moderator
end
end
def appeals
ApplicationRecord.without_timeout do
Queries::PostAppeal.all(min_date)
end
end
def flags
ApplicationRecord.without_timeout do
Queries::PostFlag.all(min_date)
end
end
def tags
Queries::Tag.all(min_date, max_level)
end

View File

@ -1,25 +0,0 @@
<table class="striped">
<caption>Appeals</caption>
<thead>
<tr>
<th>Post</th>
<th>User</th>
<th>Flags</th>
<th>Appeals</th>
<th>Score</th>
</tr>
</thead>
<tbody>
<% @dashboard.appeals.each do |post| %>
<tr>
<td><%= PostPresenter.preview(post, show_deleted: true) %></td>
<td><%= mod_link_to_user post.uploader, :negative %></td>
<td><%= post_flag_reasons(post) %></td>
<td><%= post_appeal_reasons(post) %></td>
<td><%= post.score %></td>
</tr>
<% end %>
</tbody>
</table>
<p><%= link_to "View all appeals", post_appeals_path %></p>

View File

@ -15,7 +15,6 @@
</div>
<div id="col2">
<div class="activity"><%= render "activity_appeal" %></div>
<div class="activity"><%= render "activity_user_feedback" %></div>
<div class="activity"><%= render "activity_mod_action" %></div>
</div>