blob: 3800941e700080a3e56aadb0d74979c45e7aa694 (
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
29
30
31
32
|
# frozen_string_literal: true
class Posts::DescriptionLocksController < ApplicationController
before_action :load_post
before_action :check_auth
def create
@post.update(description_editing_allowed: false)
flash[:notice] = t('posts.toggle_description_lock.locked')
# HidableLogger.log(@post, 'Description editing locked', current_user.name)
redirect_to short_post_path(@post)
end
def destroy
@post.update(description_editing_allowed: true)
flash[:notice] = t('posts.toggle_description_lock.unlocked')
redirect_to short_post_path(@post)
end
private
def load_post
@post = Post.find(params[:post_id])
end
def check_auth
authorize! :manage, @post
end
end
|