diff --git a/app/controllers/forum_posts_controller.rb b/app/controllers/forum_posts_controller.rb index 680470220..aaaf2caf2 100644 --- a/app/controllers/forum_posts_controller.rb +++ b/app/controllers/forum_posts_controller.rb @@ -54,7 +54,7 @@ class ForumPostsController < ApplicationController def destroy @forum_post = ForumPost.find(params[:id]) - raise User::PrivilegeError unless @forum_post.editable_by?(CurrentUser.user) + check_privilege(@forum_post) @forum_post.update_column(:is_deleted, true) respond_with(@forum_post) end diff --git a/app/controllers/forum_topics_controller.rb b/app/controllers/forum_topics_controller.rb index d938308f6..7d299601a 100644 --- a/app/controllers/forum_topics_controller.rb +++ b/app/controllers/forum_topics_controller.rb @@ -49,6 +49,7 @@ class ForumTopicsController < ApplicationController @forum_topic = ForumTopic.find(params[:id]) check_privilege(@forum_topic) @forum_topic.update_column(:is_deleted, true) + flash[:notice] = "Topic deleted" respond_with(@forum_topic) end @@ -56,6 +57,7 @@ class ForumTopicsController < ApplicationController @forum_topic = ForumTopic.find(params[:id]) check_privilege(@forum_topic) @forum_topic.update_column(:is_deleted, false) + flash[:notice] = "Topic undeleted" respond_with(@forum_topic) end diff --git a/app/views/forum_posts/_forum_post.html.erb b/app/views/forum_posts/_forum_post.html.erb index 5aa948025..26266c478 100644 --- a/app/views/forum_posts/_forum_post.html.erb +++ b/app/views/forum_posts/_forum_post.html.erb @@ -23,7 +23,7 @@ <% if CurrentUser.is_member? && @forum_topic %>