Commit a88f0a1f authored by Sebastian Klier's avatar Sebastian Klier

add wiki_page helper to url_builder

parent 559ef41d
...@@ -10,7 +10,8 @@ module WikiPages ...@@ -10,7 +10,8 @@ module WikiPages
# DEPRECATED # DEPRECATED
repository: @project.hook_attrs.slice(:name, :url, :description, :homepage) 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[:object_attributes].merge!(url: page_url, action: action)
hook_data hook_data
end end
......
...@@ -20,6 +20,8 @@ module Gitlab ...@@ -20,6 +20,8 @@ module Gitlab
merge_request_url(object) merge_request_url(object)
when Note when Note
note_url note_url
when WikiPage
wiki_page_url
else else
raise NotImplementedError.new("No URL builder defined for #{object.class}") raise NotImplementedError.new("No URL builder defined for #{object.class}")
end end
...@@ -58,5 +60,9 @@ module Gitlab ...@@ -58,5 +60,9 @@ module Gitlab
project_snippet_url(snippet, anchor: dom_id(object)) project_snippet_url(snippet, anchor: dom_id(object))
end end
end end
def wiki_page_url
"#{Gitlab.config.gitlab.url}#{object.wiki.wiki_base_path}/#{object.slug}"
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment