2014-04-02 10:54:41 +00:00
|
|
|
module Issues
|
2014-10-07 14:09:28 +00:00
|
|
|
class BaseService < ::IssuableBaseService
|
2015-02-19 05:02:57 +00:00
|
|
|
def hook_data(issue, action)
|
2014-10-05 13:03:15 +00:00
|
|
|
issue_data = issue.to_hook_data(current_user)
|
2016-04-13 09:25:42 +00:00
|
|
|
issue_url = Gitlab::UrlBuilder.build(issue)
|
2014-05-23 13:16:03 +00:00
|
|
|
issue_data[:object_attributes].merge!(url: issue_url, action: action)
|
2015-02-19 05:02:57 +00:00
|
|
|
issue_data
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2015-07-24 19:46:40 +00:00
|
|
|
def filter_params
|
|
|
|
super(:issue)
|
|
|
|
end
|
|
|
|
|
2015-02-19 05:02:57 +00:00
|
|
|
def execute_hooks(issue, action = 'open')
|
2016-08-30 22:11:46 +00: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 10:54:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|