Fix: Accessing threads in deleted forum, will deny access
This commit is contained in:
@@ -72,12 +72,10 @@ class ForumthreadsController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def check_permission
|
def check_permission
|
||||||
if params[:id]
|
@thread = Forumthread.find(params[:id])
|
||||||
@thread = Forumthread.find(params[:id])
|
unless @thread.can_read?(current_user)
|
||||||
unless @thread.can_read?(current_user)
|
flash[:alert] = "You are not allowed to view this thread"
|
||||||
flash[:alert] = "You are not allowed to view this thread"
|
redirect_to forums_path
|
||||||
redirect_to forums_path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user