From a5d45534b865e649a6299868c63d75a84413492a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 29 Jan 2017 10:44:51 +0000 Subject: [PATCH] Merged r16283 (#23793). git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16301 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 2 +- test/fixtures/wikis.yml | 5 +++++ test/unit/helpers/application_helper_test.rb | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0c937d30f..8966e949b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -674,7 +674,7 @@ module ApplicationHelper title ||= identifier if page.blank? end - if link_project && link_project.wiki + if link_project && link_project.wiki && User.current.allowed_to?(:view_wiki_pages, link_project) # extract anchor anchor = nil if page =~ /^(.+?)\#(.+)$/ diff --git a/test/fixtures/wikis.yml b/test/fixtures/wikis.yml index 7254fe687..56910cbbe 100644 --- a/test/fixtures/wikis.yml +++ b/test/fixtures/wikis.yml @@ -9,3 +9,8 @@ wikis_002: start_page: Start page project_id: 2 id: 2 +wikis_005: + status: 1 + start_page: Wiki + project_id: 5 + id: 5 diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 030ecb360..987668396 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -665,6 +665,7 @@ RAW end def test_wiki_links + User.current = User.find_by_login('jsmith') russian_eacape = CGI.escape(@russian_test) to_test = { '[[CookBook documentation]]' => @@ -746,6 +747,9 @@ RAW # project does not exist '[[unknowproject:Start]]' => '[[unknowproject:Start]]', '[[unknowproject:Start|Page title]]' => '[[unknowproject:Start|Page title]]', + # missing permission to view wiki in project + '[[private-child:]]' => '[[private-child:]]', + '[[private-child:Wiki]]' => '[[private-child:Wiki]]', } @project = Project.find(1) to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } -- 2.39.5