Revisions count is wrong on the wiki content page (#40655).

Contributed by Karel Pičman (@picman).


git-svn-id: https://svn.redmine.org/redmine/trunk@22877 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-06-13 03:06:04 +00:00
parent b803bddb1f
commit af6a627d20
2 changed files with 15 additions and 1 deletions

View File

@@ -85,7 +85,7 @@
<p class="wiki-update-info"> <p class="wiki-update-info">
<% if User.current.allowed_to?(:view_wiki_edits, @project) %> <% if User.current.allowed_to?(:view_wiki_edits, @project) %>
<%= wiki_content_update_info(@content) %> <%= 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 %> <% end %>
<% if @page.protected? %> <% if @page.protected? %>
<span class="badge badge-status-locked"><%= l('status_locked') %></span> <span class="badge badge-status-locked"><%= l('status_locked') %></span>

View File

@@ -233,6 +233,20 @@ class WikiControllerTest < Redmine::ControllerTest
end end
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 def test_get_new
@request.session[:user_id] = 2 @request.session[:user_id] = 2