]> source.dussan.org Git - redmine.git/commitdiff
Merged r11446 from trunk (#13232).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 11 Mar 2013 18:30:20 +0000 (18:30 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 11 Mar 2013 18:30:20 +0000 (18:30 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.2-stable@11596 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/messages_controller.rb
test/functional/messages_controller_test.rb

index d4c388c22c33e7fc0dfbe72a62be8527b70f8071..a99a9077add14d646bb5836427b77d4d706d8a7a 100644 (file)
@@ -123,7 +123,7 @@ class MessagesController < ApplicationController
 
 private
   def find_message
-    find_board
+    return unless find_board
     @message = @board.messages.find(params[:id], :include => :parent)
     @topic = @message.root
   rescue ActiveRecord::RecordNotFound
@@ -135,5 +135,6 @@ private
     @project = @board.project
   rescue ActiveRecord::RecordNotFound
     render_404
+    nil
   end
 end
index 4bf8ff90f3d6f733d8228ffa9b166504a7b3de08..168e3bb7a68d3e8767a89b0d81fa2dd254b7595b 100644 (file)
@@ -81,6 +81,11 @@ class MessagesControllerTest < ActionController::TestCase
     assert_response 404
   end
 
+  def test_show_message_from_invalid_board_should_respond_with_404
+    get :show, :board_id => 999, :id => 1
+    assert_response 404
+  end
+
   def test_get_new
     @request.session[:user_id] = 2
     get :new, :board_id => 1