diff options
author | Rémy Coutable <remy@rymai.me> | 2016-04-20 11:12:48 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-20 11:12:48 +0300 |
commit | d7127890546c317bd3469f18b9fb5e3a81554d48 (patch) | |
tree | 43e56856035dd219f4683c1f95573da180f1acda /lib | |
parent | ca3fafb904c8293e978a3d7c8c5cafdec4031558 (diff) | |
parent | edd07e2363297d4e296505a8e82eb76b2a009f10 (diff) |
Merge branch 'slack_wiki_notifications' into 'master'
add slack notifications for wiki pages
## What does this MR do?
Lets the Slack service be configured to send notifications when wiki pages are created or edited.
## Are there points in the code the reviewer needs to double check?
I'm just starting to get familiar with the Gitlab codebase and I was unsure on how to get the wiki page url to pass it to the slack message, on whether or not I needed to refactor the create/update methods for wiki pages from the controller to a service (but seemed necessary to test it better), and if I needed to add a column to the web hooks table or if the services table would have been enough. Please let me know if I should change anything and I will improve the MR, thanks for checking :)
## Why was this MR needed?
Related to #563 and fixes #4233.
See merge request !2998
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/url_builder.rb | 6 |
1 files changed, 6 insertions, 0 deletions
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 |