修正课程讨论区删除帖子BUG
This commit is contained in:
parent
f273b60f32
commit
c7f80effb7
|
@ -140,7 +140,11 @@ private
|
|||
end
|
||||
|
||||
def find_board_if_available
|
||||
@board = @project.boards.find(params[:id]) if params[:id]
|
||||
if @project
|
||||
@board = @project.boards.find(params[:id]) if params[:id]
|
||||
elsif @course
|
||||
@board = @course.boards.find(params[:id]) if params[:id]
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
|
|
@ -112,10 +112,19 @@ class MessagesController < ApplicationController
|
|||
(render_403; return false) unless @message.destroyable_by?(User.current)
|
||||
r = @message.to_param
|
||||
@message.destroy
|
||||
if @message.parent
|
||||
redirect_to board_message_path(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to project_board_path(@project, @board)
|
||||
# modify by nwb
|
||||
if @project
|
||||
if @message.parent
|
||||
redirect_to board_message_path(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to project_board_path(@project, @board)
|
||||
end
|
||||
elsif @course
|
||||
if @message.parent
|
||||
redirect_to board_message_path(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to course_board_path(@course, @board)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue