From d30367d46bcf0f21d994a48b26b619974bd5c813 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 13 Sep 2014 11:22:49 +0000 Subject: [PATCH] Issue API: include is_private attribute in xml/json output (#10914). Patch by Shivam Daryanani. git-svn-id: http://svn.redmine.org/redmine/trunk@13395 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/issues/index.api.rsb | 1 + app/views/issues/show.api.rsb | 1 + test/integration/api_test/issues_test.rb | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/app/views/issues/index.api.rsb b/app/views/issues/index.api.rsb index c3bcfd74b..7660ccbd5 100644 --- a/app/views/issues/index.api.rsb +++ b/app/views/issues/index.api.rsb @@ -17,6 +17,7 @@ api.array :issues, api_meta(:total_count => @issue_count, :offset => @offset, :l api.start_date issue.start_date api.due_date issue.due_date api.done_ratio issue.done_ratio + api.is_private issue.is_private api.estimated_hours issue.estimated_hours render_api_custom_values issue.visible_custom_field_values, api diff --git a/app/views/issues/show.api.rsb b/app/views/issues/show.api.rsb index 3878e71bd..f057b4c63 100644 --- a/app/views/issues/show.api.rsb +++ b/app/views/issues/show.api.rsb @@ -15,6 +15,7 @@ api.issue do api.start_date @issue.start_date api.due_date @issue.due_date api.done_ratio @issue.done_ratio + api.is_private @issue.is_private api.estimated_hours @issue.estimated_hours api.spent_hours(@issue.spent_hours) if User.current.allowed_to?(:view_time_entries, @project) diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index d75f17252..f6e458e99 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.rb @@ -162,6 +162,11 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base end end + def test_index_should_include_issue_attributes + get '/issues.xml' + assert_select 'issues>issue>is_private', :text => 'false' + end + def test_index_should_allow_timestamp_filtering Issue.delete_all Issue.generate!(:subject => '1').update_column(:updated_on, Time.parse("2014-01-02T10:25:00Z")) @@ -476,6 +481,11 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base end end + def test_show_should_include_issue_attributes + get '/issues/1.xml' + assert_select 'issue>is_private', :text => 'false' + end + test "GET /issues/:id.xml?include=watchers should include watchers" do Watcher.create!(:user_id => 3, :watchable => Issue.find(1)) -- 2.39.5