blob: 39a4126b37cf50b4582492d8065e9efb081b92d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# 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
|