]> source.dussan.org Git - redmine.git/commitdiff
Merged r16056 (#14817).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 20 Dec 2016 09:02:07 +0000 (09:02 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 20 Dec 2016 09:02:07 +0000 (09:02 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16097 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/timelog_controller.rb
test/functional/timelog_controller_test.rb

index acb106d3bd3dd45743c89185f67b5bbf6f554c07..908e7ebac4fce700643ecd1990f7b676b52b738a 100644 (file)
@@ -208,7 +208,7 @@ class TimelogController < ApplicationController
         else
           flash[:error] = l(:notice_unable_delete_time_entry)
         end
-        redirect_back_or_default project_time_entries_path(@projects.first)
+        redirect_back_or_default project_time_entries_path(@projects.first), :referer => true
       }
       format.api  {
         if destroyed
index c3e96793df030b8a34718170222782390cb1cd13..bb8d2ba7b758c67c75d89dd49ecbb69529f3426e 100644 (file)
@@ -579,6 +579,15 @@ class TimelogControllerTest < ActionController::TestCase
     assert_not_nil TimeEntry.find_by_id(1)
   end
 
+  def test_destroy_should_redirect_to_referer
+    referer = 'http://test.host/time_entries?utf8=✓&set_filter=1&&f%5B%5D=user_id&op%5Buser_id%5D=%3D&v%5Buser_id%5D%5B%5D=me'
+    @request.env["HTTP_REFERER"] = referer
+    @request.session[:user_id] = 2
+
+    delete :destroy, :params => {:id => 1}
+    assert_redirected_to referer
+  end
+
   def test_index_all_projects
     get :index
     assert_response :success