From 744e4357a00780583df556b9d4b5cfb0ad6517dc Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 28 Nov 2011 20:04:38 +0000 Subject: [PATCH] Fixed: Wiki export link doesn't work for users without :view_wiki_edits permission (#9682). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7971 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/wiki/show.html.erb | 6 +++--- test/functional/wiki_controller_test.rb | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index 564fc8980..22f3bab72 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -53,9 +53,9 @@ <% end %> <% other_formats_links do |f| %> - <%= f.link_to 'PDF', :url => {:id => @page.title, :version => @content.version} %> - <%= f.link_to 'HTML', :url => {:id => @page.title, :version => @content.version} %> - <%= f.link_to 'TXT', :url => {:id => @page.title, :version => @content.version} %> + <%= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %> + <%= f.link_to 'HTML', :url => {:id => @page.title, :version => params[:version]} %> + <%= f.link_to 'TXT', :url => {:id => @page.title, :version => params[:version]} %> <% end if User.current.allowed_to?(:export_wiki_pages, @project) %> <% content_for :header_tags do %> diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index e5b4bed71..8b887ecdb 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -45,6 +45,13 @@ class WikiControllerTest < ActionController::TestCase :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, :content => 'Page with an inline image' } } end + + def test_export_link + Role.anonymous.add_permission! :export_wiki_pages + get :show, :project_id => 'ecookbook' + assert_response :success + assert_tag 'a', :attributes => {:href => '/projects/ecookbook/wiki/CookBook_documentation.txt'} + end def test_show_page_with_name get :show, :project_id => 1, :id => 'Another_page' -- 2.39.5