0001-adds-option-to-include-issue-custom-fields-in-projec.patch

Jens Krämer, 2020-04-17 06:41

Download (1.9 KB)

View differences:

app/helpers/projects_helper.rb
152 152
        api.enabled_module(:id => enabled_module.id, :name => enabled_module.name)
153 153
      end
154 154
    end if include_in_api_response?('enabled_modules')
155

  
156
    api.array :issue_custom_fields do
157
      project.issue_custom_fields.each do |custom_field|
158
        api.custom_field(:id => custom_field.id, :name => custom_field.name)
159
      end
160
    end if include_in_api_response?('issue_custom_fields')
155 161
  end
156 162

  
157 163
  def bookmark_link(project, user = User.current)
test/integration/api_test/projects_test.rb
83 83
    assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]'
84 84
  end
85 85

  
86
  test "GET /projects.xml with include=issue_custom_fields should return custom fields" do
87
    get '/projects.xml?include=issue_custom_fields'
88
    assert_response :success
89
    assert_equal 'application/xml', @response.media_type
90

  
91
    assert_select 'issue_custom_fields[type=array] custom_field[name="Project 1 cf"]'
92
  end
93

  
86 94
  test "GET /projects/:id.xml should return the project" do
87 95
    Project.find(1).update!(:inherit_members => '1')
88 96

  
89
-