2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class NewIssueWorker # rubocop:disable Scalability/IdempotentWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2021-04-30 14:10:09 -04:00
|
|
|
|
2021-07-21 08:09:35 -04:00
|
|
|
data_consistency :always
|
|
|
|
|
2021-04-30 14:10:09 -04:00
|
|
|
sidekiq_options retry: 3
|
2017-08-01 08:38:45 -04:00
|
|
|
include NewIssuable
|
|
|
|
|
2021-10-27 11:13:41 -04:00
|
|
|
feature_category :team_planning
|
2020-03-02 13:07:42 -05:00
|
|
|
urgency :high
|
2019-10-30 11:14:17 -04:00
|
|
|
worker_resource_boundary :cpu
|
2020-01-24 13:09:00 -05:00
|
|
|
weight 2
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2022-08-16 08:12:38 -04:00
|
|
|
attr_reader :issuable_class
|
|
|
|
|
|
|
|
def perform(issue_id, user_id, issuable_class = 'Issue')
|
|
|
|
@issuable_class = issuable_class.constantize
|
|
|
|
|
2017-08-08 03:41:27 -04:00
|
|
|
return unless objects_found?(issue_id, user_id)
|
2017-08-01 08:38:45 -04:00
|
|
|
|
2020-09-04 11:08:46 -04:00
|
|
|
::EventCreateService.new.open_issue(issuable, user)
|
|
|
|
::NotificationService.new.new_issue(issuable, user)
|
2021-04-08 14:09:32 -04:00
|
|
|
|
2017-08-01 08:38:45 -04:00
|
|
|
issuable.create_cross_references!(user)
|
2021-04-08 14:09:32 -04:00
|
|
|
|
2021-04-13 20:10:39 -04:00
|
|
|
Issues::AfterCreateService
|
2021-05-11 23:10:21 -04:00
|
|
|
.new(project: issuable.project, current_user: user)
|
2021-04-13 20:10:39 -04:00
|
|
|
.execute(issuable)
|
2017-08-01 08:38:45 -04:00
|
|
|
end
|
|
|
|
end
|