* First draft - all the big changes * Changing some more references to 'internal' * Relocate internal request tests to admin * Relocate internal system tests to admin * Fix trailing space * Test fix * Move queries from internal to admin * Docs updates * Rename internal stimuls controllers to admin (plus docs) * Rename admin layout * Fix routing after rebase * Fixes for latest added admin interfaces * Serviceworker ignore paths
28 lines
878 B
Ruby
28 lines
878 B
Ruby
module Admin
|
|
class CommentsController < Admin::ApplicationController
|
|
layout "admin"
|
|
|
|
def index
|
|
@comments = if params[:state]&.start_with?("toplast-")
|
|
Comment
|
|
.includes(:user)
|
|
.includes(:commentable)
|
|
.order(public_reactions_count: :desc)
|
|
.where("created_at > ?", params[:state].split("-").last.to_i.days.ago)
|
|
.page(params[:page] || 1).per(50)
|
|
else
|
|
Comment
|
|
.includes(:user)
|
|
.includes(:commentable)
|
|
.order(created_at: :desc)
|
|
.page(params[:page] || 1).per(50)
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def authorize_admin
|
|
authorize Comment, :access?, policy_class: InternalPolicy
|
|
end
|
|
end
|
|
end
|