2014-09-02 18:07:02 +05:30
|
|
|
module Issues
|
2015-04-26 12:48:37 +05:30
|
|
|
class BaseService < ::IssuableBaseService
|
|
|
|
def hook_data(issue, action)
|
|
|
|
issue_data = issue.to_hook_data(current_user)
|
2016-06-02 11:05:42 +05:30
|
|
|
issue_url = Gitlab::UrlBuilder.build(issue)
|
2014-09-02 18:07:02 +05:30
|
|
|
issue_data[:object_attributes].merge!(url: issue_url, action: action)
|
2015-04-26 12:48:37 +05:30
|
|
|
issue_data
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
private
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
def filter_params
|
|
|
|
super(:issue)
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def execute_hooks(issue, action = 'open')
|
2016-09-29 09:46:39 +05:30
|
|
|
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-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|