Files
danbooru/app/controllers/post_appeals_controller.rb
evazion 652e251040 /post_{flags,appeals}: add uploader, approver, flag/appeal count columns.
Also include '»' links next to uploader/approver names for drilling down
the search by a given user.
2017-04-07 19:37:26 -05:00

35 lines
973 B
Ruby

class PostAppealsController < ApplicationController
before_filter :member_only, :except => [:index, :show]
respond_to :html, :xml, :json, :js
def new
@post_appeal = PostAppeal.new
respond_with(@post_appeal)
end
def index
@post_appeals = PostAppeal.includes(:creator).search(params[:search]).includes(post: [:appeals, :uploader, :approver])
@post_appeals = @post_appeals.paginate(params[:page], limit: params[:limit])
respond_with(@post_appeals) do |format|
format.xml do
render :xml => @post_appeals.to_xml(:root => "post-appeals")
end
end
end
def create
@post_appeal = PostAppeal.create(params[:post_appeal])
respond_with(@post_appeal)
end
def show
@post_appeal = PostAppeal.find(params[:id])
respond_with(@post_appeal)
end
private
def check_privilege(post_appeal)
raise User::PrivilegeError unless (post_appeal.creator_id == CurrentUser.id || CurrentUser.is_moderator?)
end
end