diff options
Diffstat (limited to 'app/services/issues')
-rw-r--r-- | app/services/issues/clone_service.rb | 12 | ||||
-rw-r--r-- | app/services/issues/create_service.rb | 2 | ||||
-rw-r--r-- | app/services/issues/export_csv_service.rb | 36 | ||||
-rw-r--r-- | app/services/issues/prepare_import_csv_service.rb | 19 | ||||
-rw-r--r-- | app/services/issues/update_service.rb | 7 |
5 files changed, 53 insertions, 23 deletions
diff --git a/app/services/issues/clone_service.rb b/app/services/issues/clone_service.rb index 896b15a14b8..07dd9a98f89 100644 --- a/app/services/issues/clone_service.rb +++ b/app/services/issues/clone_service.rb @@ -41,7 +41,6 @@ module Issues def update_new_entity # we don't call `super` because we want to be able to decide whether or not to copy all comments over. update_new_entity_description - copy_award_emoji if with_notes copy_notes @@ -96,9 +95,14 @@ module Issues end def add_note_from - SystemNoteService.noteable_cloned(new_entity, target_project, - original_entity, current_user, - direction: :from) + SystemNoteService.noteable_cloned( + new_entity, + target_project, + original_entity, + current_user, + direction: :from, + created_at: new_entity.created_at + ) end def add_note_to diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb index 30d4cb68840..92cf4811439 100644 --- a/app/services/issues/create_service.rb +++ b/app/services/issues/create_service.rb @@ -45,7 +45,7 @@ module Issues # current_user (defined in BaseService) is not available within run_after_commit block user = current_user issue.run_after_commit do - NewIssueWorker.perform_async(issue.id, user.id) + NewIssueWorker.perform_async(issue.id, user.id, issue.class.to_s) Issues::PlacementWorker.perform_async(nil, issue.project_id) Namespaces::OnboardingIssueCreatedWorker.perform_async(issue.project.namespace_id) end diff --git a/app/services/issues/export_csv_service.rb b/app/services/issues/export_csv_service.rb index 7076e858155..6209127bd86 100644 --- a/app/services/issues/export_csv_service.rb +++ b/app/services/issues/export_csv_service.rb @@ -25,24 +25,24 @@ module Issues { 'Title' => 'title', 'Description' => 'description', - 'Issue ID' => 'iid', - 'URL' => -> (issue) { issue_url(issue) }, - 'State' => -> (issue) { issue.closed? ? 'Closed' : 'Open' }, - 'Author' => 'author_name', - 'Author Username' => -> (issue) { issue.author&.username }, - 'Assignee' => -> (issue) { issue.assignees.map(&:name).join(', ') }, - 'Assignee Username' => -> (issue) { issue.assignees.map(&:username).join(', ') }, - 'Confidential' => -> (issue) { issue.confidential? ? 'Yes' : 'No' }, - 'Locked' => -> (issue) { issue.discussion_locked? ? 'Yes' : 'No' }, - 'Due Date' => -> (issue) { issue.due_date&.to_s(:csv) }, - 'Created At (UTC)' => -> (issue) { issue.created_at&.to_s(:csv) }, - 'Updated At (UTC)' => -> (issue) { issue.updated_at&.to_s(:csv) }, - 'Closed At (UTC)' => -> (issue) { issue.closed_at&.to_s(:csv) }, - 'Milestone' => -> (issue) { issue.milestone&.title }, - 'Weight' => -> (issue) { issue.weight }, - 'Labels' => -> (issue) { issue_labels(issue) }, - 'Time Estimate' => ->(issue) { issue.time_estimate.to_s(:csv) }, - 'Time Spent' => -> (issue) { issue_time_spent(issue) } + 'Issue ID' => 'iid', + 'URL' => -> (issue) { issue_url(issue) }, + 'State' => -> (issue) { issue.closed? ? 'Closed' : 'Open' }, + 'Author' => 'author_name', + 'Author Username' => -> (issue) { issue.author&.username }, + 'Assignee' => -> (issue) { issue.assignees.map(&:name).join(', ') }, + 'Assignee Username' => -> (issue) { issue.assignees.map(&:username).join(', ') }, + 'Confidential' => -> (issue) { issue.confidential? ? 'Yes' : 'No' }, + 'Locked' => -> (issue) { issue.discussion_locked? ? 'Yes' : 'No' }, + 'Due Date' => -> (issue) { issue.due_date&.to_s(:csv) }, + 'Created At (UTC)' => -> (issue) { issue.created_at&.to_s(:csv) }, + 'Updated At (UTC)' => -> (issue) { issue.updated_at&.to_s(:csv) }, + 'Closed At (UTC)' => -> (issue) { issue.closed_at&.to_s(:csv) }, + 'Milestone' => -> (issue) { issue.milestone&.title }, + 'Weight' => -> (issue) { issue.weight }, + 'Labels' => -> (issue) { issue_labels(issue) }, + 'Time Estimate' => ->(issue) { issue.time_estimate.to_s(:csv) }, + 'Time Spent' => -> (issue) { issue_time_spent(issue) } } end diff --git a/app/services/issues/prepare_import_csv_service.rb b/app/services/issues/prepare_import_csv_service.rb new file mode 100644 index 00000000000..7afe363117e --- /dev/null +++ b/app/services/issues/prepare_import_csv_service.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Issues + class PrepareImportCsvService < Import::PrepareService + extend ::Gitlab::Utils::Override + + private + + override :worker + def worker + ImportIssuesCsvWorker + end + + override :success_message + def success_message + _("Your issues are being imported. Once finished, you'll get a confirmation email.") + end + end +end diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index afc61eed287..46c28d82ddc 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -70,6 +70,7 @@ module Issues handle_severity_change(issue, old_severity) handle_escalation_status_change(issue) handle_issue_type_change(issue) + handle_date_changes(issue) end def handle_assignee_changes(issue, old_assignees) @@ -116,6 +117,12 @@ module Issues attr_reader :spam_params + def handle_date_changes(issue) + return unless issue.previous_changes.slice('due_date', 'start_date').any? + + GraphqlTriggers.issuable_dates_updated(issue) + end + def clone_issue(issue) target_project = params.delete(:target_clone_project) with_notes = params.delete(:clone_with_notes) |