From: Anton Khorev Date: Fri, 8 Sep 2023 14:13:57 +0000 (+0300) Subject: Add user id to api trace output X-Git-Tag: live~589^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/9682fe6431e6e7360b6dbaaa0b0c75c826a649e8?ds=sidebyside Add user id to api trace output --- diff --git a/app/views/api/traces/_trace.builder b/app/views/api/traces/_trace.builder index 7efd640f5..b56c902cd 100644 --- a/app/views/api/traces/_trace.builder +++ b/app/views/api/traces/_trace.builder @@ -3,6 +3,7 @@ attrs = { "id" => trace.id, "name" => trace.name, + "uid" => trace.user_id, "user" => trace.user.display_name, "visibility" => trace.visibility, "pending" => trace.inserted ? "false" : "true", diff --git a/test/controllers/api/traces_controller_test.rb b/test/controllers/api/traces_controller_test.rb index d85e5e1a4..468af852b 100644 --- a/test/controllers/api/traces_controller_test.rb +++ b/test/controllers/api/traces_controller_test.rb @@ -52,6 +52,7 @@ module Api auth_header = basic_authorization_header public_trace_file.user.display_name, "test" get api_trace_path(public_trace_file), :headers => auth_header assert_response :success + assert_select "gpx_file[id='#{public_trace_file.id}'][uid='#{public_trace_file.user.id}']", 1 end # Check an anonymous trace can't be specifically fetched by another user