Project

General

Profile

« Previous | Next » 

Revision cf672214

Added by Thomas McKay almost 10 years ago

fixes #6003 - don't render user default loc/org object directly

(cherry picked from commit ecac9440024dd86cb1ef0864ff024763a2225cfa)

View differences:

app/views/api/v2/users/main.json.rabl
attributes :firstname, :lastname, :mail, :admin, :auth_source_id, :auth_source_name, :last_login_on, :created_at, :updated_at
if SETTINGS[:locations_enabled]
attributes :default_location
child :default_location => :default_location do
extends "api/v2/taxonomies/base", :taxonomy => :location
end
end
if SETTINGS[:organizations_enabled]
attributes :default_organization
child :default_organization => :default_organization do
extends "api/v2/taxonomies/base"
end
end
test/functional/api/v2/users_controller_test.rb
get :show, { :id => users(:one).id }
show_response = ActiveSupport::JSON.decode(@response.body)
assert_equal taxonomies(:location1).id, show_response['default_location']['location']['id']
assert_equal taxonomies(:location1).id, show_response['default_location']['id']
assert_equal nil, show_response['default_organization']
end

Also available in: Unified diff