mirror of
https://github.com/redmine/redmine.git
synced 2025-11-09 06:46:01 +01:00
Adds option to include issue custom fields in projects#show API response (#33301).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@19714 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -152,6 +152,12 @@ module ProjectsHelper
|
|||||||
api.enabled_module(:id => enabled_module.id, :name => enabled_module.name)
|
api.enabled_module(:id => enabled_module.id, :name => enabled_module.name)
|
||||||
end
|
end
|
||||||
end if include_in_api_response?('enabled_modules')
|
end if include_in_api_response?('enabled_modules')
|
||||||
|
|
||||||
|
api.array :issue_custom_fields do
|
||||||
|
project.issue_custom_fields.each do |custom_field|
|
||||||
|
api.custom_field(:id => custom_field.id, :name => custom_field.name)
|
||||||
|
end
|
||||||
|
end if include_in_api_response?('issue_custom_fields')
|
||||||
end
|
end
|
||||||
|
|
||||||
def bookmark_link(project, user = User.current)
|
def bookmark_link(project, user = User.current)
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
|
|||||||
assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]'
|
assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "GET /projects.xml with include=issue_custom_fields should return custom fields" do
|
||||||
|
get '/projects.xml?include=issue_custom_fields'
|
||||||
|
assert_response :success
|
||||||
|
assert_equal 'application/xml', @response.media_type
|
||||||
|
|
||||||
|
assert_select 'issue_custom_fields[type=array] custom_field[name="Project 1 cf"]'
|
||||||
|
end
|
||||||
|
|
||||||
test "GET /projects/:id.xml should return the project" do
|
test "GET /projects/:id.xml should return the project" do
|
||||||
Project.find(1).update!(:inherit_members => '1')
|
Project.find(1).update!(:inherit_members => '1')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user