Files
danbooru/app/controllers/reports_controller.rb
evazion d0f060d8eb api: refactor api attribute declarations.
Replace the `method_attributes` and `hidden_attributes` methods with
`api_attributes`. `api_attributes` can be used as a class macro:

    # include only the given attributes.
    api_attributes :id, :created_at, :creator_name, ...

    # include all default attributes plus the `creator_name` method.
    api_attributes including: [:creator_name]

or as an instance method:

    def api_attributes
       [:id, :created_at, :creator_name, ...]
    end

By default, all attributes are included except for IP addresses and
tsvector columns.
2019-09-08 23:28:02 -05:00

35 lines
1.2 KiB
Ruby

class ReportsController < ApplicationController
before_action :member_only, :except => [:upload_tags]
before_action :moderator_only, :only => [:post_versions, :post_versions_create, :down_voting_post_report, :down_voting_post_report_create]
respond_to :html, :xml, :json, only: [:upload_tags]
def uploads
@report = Reports::Uploads.new(params[:min_date], params[:max_date], params[:queries])
end
def post_versions
end
def post_versions_create
@report = Reports::PostVersions.new(params[:tag], params[:type])
end
def upload_tags
@user = User.find(params[:user_id])
@upload_reports = Reports::UploadTags.includes(versions: { post: :versions }).for_user(params[:user_id]).order("id desc").paginate(params[:page], :limit => params[:limit])
respond_with(@upload_reports)
end
def down_voting_post
end
def down_voting_post_create
user_id = CurrentUser.id
post_id = params[:post_id].to_i
sqs = SqsService.new(Danbooru.config.aws_sqs_async_reports)
sqs.send_message("targetedpostdownvoting-#{user_id}-#{post_id}")
flash[:notice] = "You will be messaged when the report has finished generating"
redirect_to reports_down_voting_post_path
end
end