From 5ac8020801724a8a5a5dcc95e684e918f81cdcd9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 27 Nov 2011 17:30:28 +0000 Subject: [PATCH] Do not include extra_info attribute in SysController responses because it breaks reposman activeresource client (#8707). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7956 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/sys_controller.rb | 5 +++-- test/functional/sys_controller_test.rb | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/controllers/sys_controller.rb b/app/controllers/sys_controller.rb index 9a8c22fc7..89ad19ad4 100644 --- a/app/controllers/sys_controller.rb +++ b/app/controllers/sys_controller.rb @@ -20,7 +20,8 @@ class SysController < ActionController::Base def projects p = Project.active.has_module(:repository).find(:all, :include => :repository, :order => 'identifier') - render :xml => p.to_xml(:include => :repository) + # extra_info attribute from repository breaks activeresource client + render :xml => p.to_xml(:only => [:id, :identifier, :name, :is_public, :status], :include => {:repository => {:only => [:id, :url]}}) end def create_project_repository @@ -31,7 +32,7 @@ class SysController < ActionController::Base logger.info "Repository for #{project.name} was reported to be created by #{request.remote_ip}." project.repository = Repository.factory(params[:vendor], params[:repository]) if project.repository && project.repository.save - render :xml => project.repository, :status => 201 + render :xml => project.repository.to_xml(:only => [:id, :url]), :status => 201 else render :nothing => true, :status => 422 end diff --git a/test/functional/sys_controller_test.rb b/test/functional/sys_controller_test.rb index c33057377..c448e7704 100644 --- a/test/functional/sys_controller_test.rb +++ b/test/functional/sys_controller_test.rb @@ -39,7 +39,10 @@ class SysControllerTest < ActionController::TestCase assert_equal 'application/xml', @response.content_type with_options :tag => 'projects' do |test| test.assert_tag :children => { :count => Project.active.has_module(:repository).count } + test.assert_tag 'project', :child => {:tag => 'identifier', :sibling => {:tag => 'is-public'}} end + assert_no_tag 'extra-info' + assert_no_tag 'extra_info' end def test_create_project_repository @@ -49,10 +52,19 @@ class SysControllerTest < ActionController::TestCase :vendor => 'Subversion', :repository => { :url => 'file:///create/project/repository/subproject2'} assert_response :created + assert_equal 'application/xml', @response.content_type r = Project.find(4).repository assert r.is_a?(Repository::Subversion) assert_equal 'file:///create/project/repository/subproject2', r.url + + assert_tag 'repository-subversion', + :child => { + :tag => 'id', :content => r.id.to_s, + :sibling => {:tag => 'url', :content => r.url} + } + assert_no_tag 'extra-info' + assert_no_tag 'extra_info' end def test_fetch_changesets -- 2.39.5