2014-04-02 06:54:41 -04:00
|
|
|
module Issues
|
2014-10-07 10:09:28 -04:00
|
|
|
class BaseService < ::IssuableBaseService
|
2015-02-19 00:02:57 -05:00
|
|
|
def hook_data(issue, action)
|
2014-10-05 09:03:15 -04:00
|
|
|
issue_data = issue.to_hook_data(current_user)
|
2016-04-13 05:25:42 -04:00
|
|
|
issue_url = Gitlab::UrlBuilder.build(issue)
|
2014-05-23 09:16:03 -04:00
|
|
|
issue_data[:object_attributes].merge!(url: issue_url, action: action)
|
2015-02-19 00:02:57 -05:00
|
|
|
issue_data
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def execute_hooks(issue, action = 'open')
|
2016-08-30 18:11:46 -04:00
|
|
|
issue_data = hook_data(issue, action)
|
|
|
|
hooks_scope = issue.confidential? ? :confidential_issue_hooks : :issue_hooks
|
|
|
|
issue.project.execute_hooks(issue_data, hooks_scope)
|
|
|
|
issue.project.execute_services(issue_data, hooks_scope)
|
2014-04-02 06:54:41 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|