# frozen_string_literal: true class Posts::FilesController < ApplicationController include ImageUpload before_action :load_image before_action :check_auth def update PostReplacer.new(@post).replace_file!(post_media_params) redirect_to short_post_path(@post) end def post_params params.permit(:file, :file_cache, :file_type_cache, :paste_input, :scraper_url, :scraper_cache, :file_type_cache) end private def load_image @post = Post.find_by!(id: params[:post_id]) end def check_auth authorize! :manage, @post end end