blob: a538790ef8b9483a02fa832b985fcb7a7185b038 (
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
|
# frozen_string_literal: true
class Posts::DescriptionsController < ApplicationController
before_action :filter_banned_users
before_action :load_post
before_action :check_auth
def update
if @post.description_editing_allowed || can?(:manage, Post)
@post.update(description: params[:description])
# DescriptionChangeLogger.log(@post, current_user)
end
render partial: 'posts/description', layout: false
end
private
def load_post
@post = Post.find_by!(id: params[:post_id], hidden_from_users: false)
end
def check_auth
authorize! :update, @post
end
end
|