debian-mirror-gitlab/app/services/issues/base_service.rb

24 lines
606 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module Issues
2015-04-26 12:48:37 +05:30
class BaseService < ::IssuableBaseService
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
def hook_data(issue, action)
issue_data = issue.to_hook_data(current_user)
2014-09-02 18:07:02 +05:30
issue_url = Gitlab::UrlBuilder.new(:issue).build(issue.id)
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')
issue_data = hook_data(issue, action)
issue.project.execute_hooks(issue_data, :issue_hooks)
issue.project.execute_services(issue_data, :issue_hooks)
2014-09-02 18:07:02 +05:30
end
end
end