summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Sidorenko <artem@posteo.de>2016-05-03 17:33:43 +0200
committerArtem Sidorenko <artem@posteo.de>2016-05-13 22:42:07 +0200
commite5c97101478829fe8200557afd02bde92c3eb4e4 (patch)
treeda0fbf9b2c2020e0b39336663557b3645ea50926
parent5e130c3e39febcd577e61ebd30bd231827d41f2c (diff)
downloadgitlab-ce-e5c97101478829fe8200557afd02bde92c3eb4e4.tar.gz
Use the relative url prefix for links in Wiki
-rw-r--r--CHANGELOG3
-rw-r--r--app/models/project_wiki.rb2
-rw-r--r--lib/gitlab/url_builder.rb2
-rw-r--r--spec/models/project_wiki_spec.rb3
4 files changed, 7 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 30d4955c9f3..5ffe91ce4e0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -52,6 +52,9 @@ v 8.8.0 (unreleased)
- Hide left sidebar on phone screens to give more space for content
- Redesign navigation for profile and group pages
+v 8.7.6
+ - Fix links on wiki pages for relative url setups. !4131 (Artem Sidorenko)
+
v 8.7.5
- Fix relative links in wiki pages. !4050
- Fix always showing build notification message when switching between merge requests !4086
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index 060ed9b44ec..339fb0b9f9d 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -40,7 +40,7 @@ class ProjectWiki
end
def wiki_base_path
- ["/", @project.path_with_namespace, "/wikis"].join('')
+ [Gitlab.config.gitlab.relative_url_root, "/", @project.path_with_namespace, "/wikis"].join('')
end
# Returns the Gollum::Wiki object.
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
index 2bbbd3074e8..fe65c246101 100644
--- a/lib/gitlab/url_builder.rb
+++ b/lib/gitlab/url_builder.rb
@@ -62,7 +62,7 @@ module Gitlab
end
def wiki_page_url
- "#{Gitlab.config.gitlab.url}#{object.wiki.wiki_base_path}/#{object.slug}"
+ namespace_project_wiki_url(object.wiki.project.namespace, object.wiki.project, object.slug)
end
end
end
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb
index 532e3f013fd..91ebb612baa 100644
--- a/spec/models/project_wiki_spec.rb
+++ b/spec/models/project_wiki_spec.rb
@@ -38,7 +38,8 @@ describe ProjectWiki, models: true do
describe "#wiki_base_path" do
it "returns the wiki base path" do
- wiki_base_path = "/#{project.path_with_namespace}/wikis"
+ wiki_base_path = "#{Gitlab.config.gitlab.relative_url_root}/#{project.path_with_namespace}/wikis"
+
expect(subject.wiki_base_path).to eq(wiki_base_path)
end
end