From: Tom Hughes Date: Sun, 1 Sep 2024 09:51:50 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/5135' X-Git-Tag: live~231 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/33a2ccf560dbb4054d260a7ba9b4a572d4668ae9?hp=d419a5d6c844d841d10a46437ab5fff236dfc0b0 Merge remote-tracking branch 'upstream/pull/5135' --- diff --git a/app/controllers/traces_controller.rb b/app/controllers/traces_controller.rb index 02b553d0a..d723bac5b 100644 --- a/app/controllers/traces_controller.rb +++ b/app/controllers/traces_controller.rb @@ -143,7 +143,7 @@ class TracesController < ApplicationController flash[:notice] = t ".updated" redirect_to :action => "show", :display_name => current_user.display_name else - @title = t ".title", :name => @trace.name + @title = t "traces.edit.title", :name => @trace.name render :action => "edit" end rescue ActiveRecord::RecordNotFound diff --git a/test/controllers/traces_controller_test.rb b/test/controllers/traces_controller_test.rb index 972cbb3c3..c5f503d62 100644 --- a/test/controllers/traces_controller_test.rb +++ b/test/controllers/traces_controller_test.rb @@ -667,6 +667,17 @@ class TracesControllerTest < ActionDispatch::IntegrationTest assert_equal new_details[:visibility], trace.visibility end + # Test invalid updates + def test_update_invalid + trace = create(:trace) + + # Invalid visibility + session_for(trace.user) + put trace_path(trace, :trace => { :description => "Changed description", :tagstring => "new_tag", :visibility => "wrong" }) + assert_response :success + assert_select "title", :text => /^Editing Trace/ + end + # Test destroying a trace def test_destroy public_trace_file = create(:trace, :visibility => "public")