* Rubocop enabled style/alias * Enabled Style/ArrayJoin Cop * Enabled Style/Attr * Enabled Case Equality * Enabled CharacterLiteral * Enabled ColonMethodCall Cop * Enabled CommentAnnotation cop * Enabled PreferredHashMethods Cop * Enabled DoubleNegation Cop * Enabled EachWithObject Cop * Enabled EmptyLiteral Cop * Enabled EvenOdd Cop * Enabled IfWithSemicolon Cop * Enabled Lambda and LambdaCall Cop * Enabled LineEndConcatenation Cop * Enabled ModuleFunction Cop; * Enable NegatedIf and NegatedWhile Cop * Enabled NilComparison Cop * Enabled Not Cop * Enabled NumericLiterals Cop * Enabled OneLineConditional Cop * Enabled PercentLiteralDelimiters Cop * Excluded internal/users_controller from negated_if cop * Reverted the double negation change from github_issue_tag and github_issue.rb" * Enabled PerlBackrefs Cop * Changed Regexp.last_match(1) to Regexp.last_match(0) * Enabled proc cop * Enabled RaiseArgs Cop * Reverted Regexp.last_match(0) to Regexp.last_match(1) * Enabled SelfAssignment Cop * Enabled SingleLineMethods Cop * Enabled SpecialGlobalVars Cop * Enabled VariableInterpolation Cop * Enabled WhenThen Cop * Enabled WhileUntilModifier Cop * Enabled WordArray Cop * Enabled IfUnlessModifier Cop * Enabled GuardClause Cop
31 lines
820 B
Ruby
31 lines
820 B
Ruby
class ModerationsController < ApplicationController
|
|
after_action :verify_authorized
|
|
|
|
def index
|
|
skip_authorization
|
|
return unless current_user&.trusted
|
|
|
|
@articles = Article.where(published: true).
|
|
includes(:rating_votes).
|
|
where("rating_votes_count < 3").
|
|
where("score > -5").
|
|
order("hotness_score DESC").limit(50)
|
|
if params[:tag].present?
|
|
@articles = @articles.
|
|
cached_tagged_with(params[:tag])
|
|
end
|
|
@articles = @articles.decorate
|
|
end
|
|
|
|
def article
|
|
authorize(User, :moderation_routes?)
|
|
@moderatable = Article.find_by_slug(params[:slug])
|
|
render template: "moderations/mod"
|
|
end
|
|
|
|
def comment
|
|
authorize(User, :moderation_routes?)
|
|
@moderatable = Comment.find(params[:id_code].to_i(26))
|
|
render template: "moderations/mod"
|
|
end
|
|
end
|