From 27c3c42e2dbe7f87538c5d444d89dec0b97c4876 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 17 Jun 2024 07:45:00 +0000 Subject: Merged r22877 from trunk to 5.1-stable (#40655). git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@22883 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/wiki/show.html.erb | 2 +- test/functional/wiki_controller_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index 6a0245809..be0d7355a 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -85,7 +85,7 @@

<% if User.current.allowed_to?(:view_wiki_edits, @project) %> <%= wiki_content_update_info(@content) %> - · <%= link_to l(:label_x_revisions, :count => @content.version), {:action => 'history', :id => @page.title} %> + · <%= link_to l(:label_x_revisions, :count => @page.content.versions.size), {:action => 'history', :id => @page.title} %> <% end %> <% if @page.protected? %> <%= l('status_locked') %> diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 215c9caf4..1e1d98f32 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -233,6 +233,20 @@ class WikiControllerTest < Redmine::ControllerTest end end + def test_show_should_display_revisions_count + # To ensure that the number of versions is correctly displayed instead of + # the last version number of the wiki page, make a situation where the + # those two numbers are different. + content_versions = WikiContentVersion.where(page_id: 1) + content_versions.first.destroy + assert 3, content_versions.last.version + assert 2, content_versions.size + + get :show, :params => {:project_id => 1, :id => 'CookBook_documentation'} + assert_response :success + assert_select 'a[href=?]', '/projects/1/wiki/CookBook_documentation/history', :text => /2 revisions/ + end + def test_get_new @request.session[:user_id] = 2 -- cgit v1.2.3