models: add deletable concern.
This commit is contained in:
@@ -61,14 +61,14 @@ class CommentsController < ApplicationController
|
||||
def destroy
|
||||
@comment = Comment.find(params[:id])
|
||||
check_privilege(@comment)
|
||||
@comment.delete!
|
||||
@comment.update(is_deleted: true)
|
||||
respond_with(@comment)
|
||||
end
|
||||
|
||||
def undelete
|
||||
@comment = Comment.find(params[:id])
|
||||
check_privilege(@comment)
|
||||
@comment.undelete!
|
||||
@comment.update(is_deleted: false)
|
||||
respond_with(@comment)
|
||||
end
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class ForumTopicsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
check_privilege(@forum_topic)
|
||||
@forum_topic.delete!
|
||||
@forum_topic.update(is_deleted: true)
|
||||
@forum_topic.create_mod_action_for_delete
|
||||
flash[:notice] = "Topic deleted"
|
||||
respond_with(@forum_topic)
|
||||
@@ -75,7 +75,7 @@ class ForumTopicsController < ApplicationController
|
||||
|
||||
def undelete
|
||||
check_privilege(@forum_topic)
|
||||
@forum_topic.undelete!
|
||||
@forum_topic.update(is_deleted: false)
|
||||
@forum_topic.create_mod_action_for_undelete
|
||||
flash[:notice] = "Topic undeleted"
|
||||
respond_with(@forum_topic)
|
||||
|
||||
Reference in New Issue
Block a user