From: Marius Balteanu Date: Sun, 20 Feb 2022 15:52:53 +0000 (+0000) Subject: Merged r21414 to 4.2-stable (#36494). X-Git-Tag: 4.2.4~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=31eb388f261aa1fb2c5ab1f1010a4de56c3dea65;p=redmine.git Merged r21414 to 4.2-stable (#36494). git-svn-id: http://svn.redmine.org/redmine/branches/4.2-stable@21420 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/wiki/show.api.rsb b/app/views/wiki/show.api.rsb index 8e082e123..6165a94cc 100644 --- a/app/views/wiki/show.api.rsb +++ b/app/views/wiki/show.api.rsb @@ -5,7 +5,7 @@ api.wiki_page do end api.text @content.text api.version @content.version - api.author(:id => @content.author_id, :name => @content.author.name) + api.author(:id => @content.author_id, :name => @content.author.name) unless @content.author_id.nil? api.comments @content.comments api.created_on @page.created_on api.updated_on @content.updated_on diff --git a/test/integration/api_test/wiki_pages_test.rb b/test/integration/api_test/wiki_pages_test.rb index 73fd74137..389f2b97a 100644 --- a/test/integration/api_test/wiki_pages_test.rb +++ b/test/integration/api_test/wiki_pages_test.rb @@ -126,6 +126,17 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base assert_equal 'jsmith', page.content.author.login end + test "GET /projects/:project_id/wiki/:title/:version.xml should not includ author if not exists" do + WikiContentVersion.find_by_id(2).update(author_id: nil) + + get '/projects/ecookbook/wiki/CookBook_documentation/2.xml' + assert_response 200 + assert_equal 'application/xml', response.media_type + assert_select 'wiki_page' do + assert_select 'author', 0 + end + end + test "PUT /projects/:project_id/wiki/:title.xml with current versino should update wiki page" do assert_no_difference 'WikiPage.count' do assert_difference 'WikiContent::Version.count' do