Remove priority action from `ModerationController`
This commit is contained in:
parent
32a973a048
commit
fafefc3dc0
|
@ -13,48 +13,6 @@ class ModerationController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def priority
|
||||
@user_id = params[:user_id]
|
||||
if @user_id.nil?
|
||||
@users = {}
|
||||
Report.where(deleted: false).each do |report|
|
||||
target = if report.target.is_a? User
|
||||
report.target
|
||||
elsif report.target.respond_to? :user
|
||||
report.target.user
|
||||
else
|
||||
nil
|
||||
end
|
||||
|
||||
next if target.nil?
|
||||
|
||||
@users[target] ||= 0
|
||||
@users[target] += 1
|
||||
end
|
||||
|
||||
@users = @users.sort_by do |k, v|
|
||||
v
|
||||
end.reverse
|
||||
|
||||
@users = Hash[@users]
|
||||
else
|
||||
@user_id = @user_id.to_i
|
||||
@type = 'all'
|
||||
@reports = []
|
||||
Report.where(deleted: false).each do |report|
|
||||
if report.target.is_a? User
|
||||
@reports.push report if report.target.id == @user_id
|
||||
else
|
||||
next if report.target.user.nil?
|
||||
@reports.push report if report.target.user.id == @user_id
|
||||
end
|
||||
end
|
||||
|
||||
@target_user = User.find(@user_id)
|
||||
render template: 'moderation/index'
|
||||
end
|
||||
end
|
||||
|
||||
def toggle_unmask
|
||||
session[:moderation_view] = !session[:moderation_view]
|
||||
redirect_back fallback_location: root_path
|
||||
|
|
Loading…
Reference in New Issue