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