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
|
|
|
|
|
2015-07-24 15:46:40 -04:00
|
|
|
def filter_params
|
|
|
|
super(:issue)
|
|
|
|
end
|
|
|
|
|
2015-02-19 00:02:57 -05:00
|
|
|
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
|