diff options
author | Sebastian Klier <sebastian@sebastianklier.com> | 2016-04-05 08:36:09 +0300 |
---|---|---|
committer | Sebastian Klier <sebastian@sebastianklier.com> | 2016-04-20 03:25:41 +0300 |
commit | a88f0a1fd8fc150432729f525f1c2cecde93301a (patch) | |
tree | 1d4298773bbb37c867fc222832b473d8b158de32 | |
parent | 559ef41d32db10b79fe7b6cfa42b8cd019ca8415 (diff) |
add wiki_page helper to url_builder
-rw-r--r-- | app/services/wiki_pages/base_service.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/url_builder.rb | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/services/wiki_pages/base_service.rb b/app/services/wiki_pages/base_service.rb index e4c0506e20c..9ab9d187413 100644 --- a/app/services/wiki_pages/base_service.rb +++ b/app/services/wiki_pages/base_service.rb @@ -10,7 +10,8 @@ module WikiPages # DEPRECATED repository: @project.hook_attrs.slice(:name, :url, :description, :homepage) } - page_url = "#{Gitlab.config.gitlab.url}#{@project.wiki.wiki_base_path}/#{page.slug}" + + page_url = Gitlab::UrlBuilder.new(:wiki_page).build(page) hook_data[:object_attributes].merge!(url: page_url, action: action) hook_data end diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb index f1943222edf..2bbbd3074e8 100644 --- a/lib/gitlab/url_builder.rb +++ b/lib/gitlab/url_builder.rb @@ -20,6 +20,8 @@ module Gitlab merge_request_url(object) when Note note_url + when WikiPage + wiki_page_url else raise NotImplementedError.new("No URL builder defined for #{object.class}") end @@ -58,5 +60,9 @@ module Gitlab project_snippet_url(snippet, anchor: dom_id(object)) end end + + def wiki_page_url + "#{Gitlab.config.gitlab.url}#{object.wiki.wiki_base_path}/#{object.slug}" + end end end |