diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index afb88c263b..36766ecc0e 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -16,6 +16,7 @@ <%= link_to_if_authorized(l(:button_unlock), {:action => 'protect', :id => @page.title, :protected => 0}, :method => :post, :class => 'icon icon-unlock') if @page.protected? %> <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :id => @page.title}, :class => 'icon icon-move') %> <% @redirects_to_self.map { |redirect| %> + <%= link_to("Delete redirect from #{WikiPage.pretty_title(redirect.title)}", {:controller => 'wiki_redirects', :action => 'destroy', :project_id => @project.identifier, :wiki_page_id => @page.title, :id => redirect.id}, :method => :delete, :class => 'icon icon-link-break') %> <% } %> <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :id => @page.title}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :class => 'icon icon-del') %> diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 8cc85d4c9f..8a6f61271b 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -213,6 +213,23 @@ def test_show_delete_redirect_links end end + # TODO: + # def test_hide_delete_redirect_links_without_permission + # # TODO: Create user with edit_wiki_pages permission but without rename_wiki_pages + # @request.session[:user_id] = 2 # user_with_role(role: 'Developer', project: 'ecookbook') + # wiki_page = WikiPage.find_by(title: 'CookBook_documentation') + + # new_title = 'New_Cookbook' + # wiki_page.title = new_title + # wiki_page.save + + # get :show, :params => {:project_id => 'ecookbook', :id => new_title} + + # assert_select '.drdn-items' do + # assert_select 'a.icon-link-break', text: 'Delete redirect from CookBook documentation', count: 0 + # end + # end + def test_get_new @request.session[:user_id] = 2