Support for Ruby 2.0.0
This commit is contained in:
parent
545da39dd3
commit
2aef9bd71f
|
@ -17,18 +17,23 @@ class ModerationController < ApplicationController
|
||||||
Report.where(deleted: false).each do |report|
|
Report.where(deleted: false).each do |report|
|
||||||
target = if report.target.is_a? User
|
target = if report.target.is_a? User
|
||||||
report.target
|
report.target
|
||||||
else
|
elsif report.target.respond_to? :user
|
||||||
next if report.target.user.nil?
|
|
||||||
report.target.user
|
report.target.user
|
||||||
|
else
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
next if target.nil?
|
||||||
|
|
||||||
@users[target] ||= 0
|
@users[target] ||= 0
|
||||||
@users[target] += 1
|
@users[target] += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@users = @users.sort_by do |k, v|
|
@users = @users.sort_by do |k, v|
|
||||||
v
|
v
|
||||||
end.reverse.to_h
|
end.reverse
|
||||||
|
|
||||||
|
Hash[@users]
|
||||||
else
|
else
|
||||||
@user_id = @user_id.to_i
|
@user_id = @user_id.to_i
|
||||||
@type = 'all'
|
@type = 'all'
|
||||||
|
|
Loading…
Reference in New Issue