From: biswesh456 Date: Sat, 3 Mar 2018 14:50:52 +0000 (+0530) Subject: Change test case X-Git-Tag: live~3650^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/674589ce2c196fa2c6d249e09e374e9ff090bb77 Change test case --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 81c786473..5dd49c6be 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -192,7 +192,11 @@ class TraceController < ApplicationController trace.visible = false trace.save flash[:notice] = t "trace.delete.scheduled_for_deletion" - redirect_to :action => :list, :display_name => current_user.display_name + if current_user.administrator? || current_user.moderator? + redirect_to :action => :list, :display_name => trace.user.display_name + else + redirect_to :action => :list, :display_name => current_user.display_name + end end rescue ActiveRecord::RecordNotFound head :not_found diff --git a/test/controllers/trace_controller_test.rb b/test/controllers/trace_controller_test.rb index a9008bc97..23a2e5261 100644 --- a/test/controllers/trace_controller_test.rb +++ b/test/controllers/trace_controller_test.rb @@ -690,9 +690,9 @@ class TraceControllerTest < ActionController::TestCase public_trace_file = create(:trace, :visibility => "public") admin = create(:administrator_user) - post :delete, :params => { :display_name => admin.display_name, :id => public_trace_file.id }, :session => { :user => admin } + post :delete, :params => { :display_name => public_trace_file.user.display_name, :id => public_trace_file.id }, :session => { :user => admin } assert_response :redirect - assert_redirected_to :action => :list, :display_name => admin.display_name + assert_redirected_to :action => :list, :display_name => public_trace_file.user.display_name trace = Trace.find(public_trace_file.id) assert_equal false, trace.visible end