summaryrefslogtreecommitdiff
path: root/lib/gitlab/url_builder.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /lib/gitlab/url_builder.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'lib/gitlab/url_builder.rb')
-rw-r--r--lib/gitlab/url_builder.rb23
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
index 329f87d8be8..cd15130cee6 100644
--- a/lib/gitlab/url_builder.rb
+++ b/lib/gitlab/url_builder.rb
@@ -41,7 +41,7 @@ module Gitlab
when Wiki
wiki_url(object, **options)
when WikiPage
- instance.project_wiki_url(object.wiki.project, object.slug, **options)
+ wiki_page_url(object.wiki, object, **options)
when ::DesignManagement::Design
design_url(object, **options)
else
@@ -78,12 +78,21 @@ module Gitlab
end
end
- def wiki_url(object, **options)
- if object.container.is_a?(Project)
- instance.project_wiki_url(object.container, Wiki::HOMEPAGE, **options)
- else
- raise NotImplementedError.new("No URL builder defined for #{object.inspect}")
- end
+ def wiki_url(wiki, **options)
+ return wiki_page_url(wiki, Wiki::HOMEPAGE, **options) unless options[:action]
+
+ options[:controller] = 'projects/wikis'
+ options[:namespace_id] = wiki.container.namespace
+ options[:project_id] = wiki.container
+
+ instance.url_for(**options)
+ end
+
+ def wiki_page_url(wiki, page, **options)
+ options[:action] ||= :show
+ options[:id] = page
+
+ wiki_url(wiki, **options)
end
def design_url(design, **options)