2014-04-02 06:54:41 -04:00
|
|
|
module Issues
|
2014-10-07 10:09:28 -04:00
|
|
|
class BaseService < ::IssuableBaseService
|
2014-04-02 06:54:41 -04:00
|
|
|
|
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)
|
2014-06-13 06:34:15 -04:00
|
|
|
issue_url = Gitlab::UrlBuilder.new(:issue).build(issue.id)
|
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')
|
|
|
|
issue_data = hook_data(issue, action)
|
2014-05-23 09:16:03 -04:00
|
|
|
issue.project.execute_hooks(issue_data, :issue_hooks)
|
2015-02-19 00:02:57 -05:00
|
|
|
issue.project.execute_services(issue_data, :issue_hooks)
|
2014-04-02 06:54:41 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|