afe5d7d209
1) Adds a DB migration for all services to toggle on push, issue, and merge events. 2) Upon an issue or merge request event, fire service hooks. 3) Slack service supports custom messages for each of these events. Other services not supported at the moment. 4) Label merge request hooks with their corresponding actions.
19 lines
555 B
Ruby
19 lines
555 B
Ruby
module Issues
|
|
class BaseService < ::IssuableBaseService
|
|
|
|
def hook_data(issue, action)
|
|
issue_data = issue.to_hook_data(current_user)
|
|
issue_url = Gitlab::UrlBuilder.new(:issue).build(issue.id)
|
|
issue_data[:object_attributes].merge!(url: issue_url, action: action)
|
|
issue_data
|
|
end
|
|
|
|
private
|
|
|
|
def execute_hooks(issue, action = 'open')
|
|
issue_data = hook_data(issue, action)
|
|
issue.project.execute_hooks(issue_data, :issue_hooks)
|
|
issue.project.execute_services(issue_data, :issue_hooks)
|
|
end
|
|
end
|
|
end
|