Allow users to delete their own comments
This commit is contained in:
committed by
Javi Martín
parent
fa14976cfd
commit
0698c0ff4f
@@ -1,5 +1,5 @@
|
||||
class CommentsController < ApplicationController
|
||||
before_action :authenticate_user!, only: :create
|
||||
before_action :authenticate_user!, only: [:create, :hide]
|
||||
before_action :load_commentable, only: :create
|
||||
before_action :verify_resident_for_commentable!, only: :create
|
||||
before_action :verify_comments_open!, only: [:create, :vote]
|
||||
@@ -46,6 +46,11 @@ class CommentsController < ApplicationController
|
||||
render "shared/_refresh_flag_actions", locals: { flaggable: @comment, divider: true }
|
||||
end
|
||||
|
||||
def hide
|
||||
@comment.hide
|
||||
set_comment_flags(@comment.subtree)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def comment_params
|
||||
|
||||
Reference in New Issue
Block a user