2018-07-16 12:31:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-04-02 06:54:41 -04:00
|
|
|
module Issues
|
2014-10-07 10:09:28 -04:00
|
|
|
class BaseService < ::IssuableBaseService
|
2017-11-21 12:13:07 -05:00
|
|
|
def hook_data(issue, action, old_associations: {})
|
|
|
|
hook_data = issue.to_hook_data(current_user, old_associations: old_associations)
|
2017-09-15 13:08:27 -04:00
|
|
|
hook_data[:object_attributes][:action] = action
|
|
|
|
|
|
|
|
hook_data
|
2015-02-19 00:02:57 -05:00
|
|
|
end
|
|
|
|
|
2017-07-20 10:42:33 -04:00
|
|
|
def reopen_service
|
|
|
|
Issues::ReopenService
|
|
|
|
end
|
|
|
|
|
|
|
|
def close_service
|
|
|
|
Issues::CloseService
|
|
|
|
end
|
|
|
|
|
2015-02-19 00:02:57 -05:00
|
|
|
private
|
|
|
|
|
2017-05-04 08:11:15 -04:00
|
|
|
def create_assignee_note(issue, old_assignees)
|
2019-04-07 14:35:16 -04:00
|
|
|
SystemNoteService.change_issuable_assignees(
|
2017-05-04 08:11:15 -04:00
|
|
|
issue, issue.project, current_user, old_assignees)
|
|
|
|
end
|
|
|
|
|
2017-11-21 12:13:07 -05:00
|
|
|
def execute_hooks(issue, action = 'open', old_associations: {})
|
|
|
|
issue_data = hook_data(issue, action, old_associations: old_associations)
|
2016-08-30 18:11:46 -04:00
|
|
|
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 06:54:41 -04:00
|
|
|
end
|
2017-05-04 08:11:15 -04:00
|
|
|
|
2017-11-09 14:34:21 -05:00
|
|
|
def update_project_counter_caches?(issue)
|
|
|
|
super || issue.confidential_changed?
|
|
|
|
end
|
2014-04-02 06:54:41 -04:00
|
|
|
end
|
|
|
|
end
|