diff options
Diffstat (limited to 'app/services/issues/update_service.rb')
-rw-r--r-- | app/services/issues/update_service.rb | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index 702527d80a7..af5029f8364 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -24,7 +24,7 @@ module Issues def filter_params(issue) super - # filter confidential in `Issues::UpdateService` and not in `IssuableBaseService#filtr_params` + # filter confidential in `Issues::UpdateService` and not in `IssuableBaseService#filter_params` # because we do allow users that cannot admin issues to set confidential flag when creating an issue unless can_admin_issuable?(issue) params.delete(:confidential) @@ -42,10 +42,6 @@ module Issues ).execute(spam_params: spam_params) end - def after_update(issue) - IssuesChannel.broadcast_to(issue, event: 'updated') if Gitlab::ActionCable::Config.in_app? || Feature.enabled?(:broadcast_issue_updates, issue.project) - end - def handle_changes(issue, options) old_associations = options.fetch(:old_associations, {}) old_labels = old_associations.fetch(:labels, []) @@ -61,12 +57,7 @@ module Issues todo_service.update_issue(issue, current_user, old_mentioned_users) end - if issue.assignees != old_assignees - create_assignee_note(issue, old_assignees) - notification_service.async.reassigned_issue(issue, current_user, old_assignees) - todo_service.reassigned_assignable(issue, current_user, old_assignees) - track_incident_action(current_user, issue, :incident_assigned) - end + handle_assignee_changes(issue, old_assignees) if issue.previous_changes.include?('confidential') # don't enqueue immediately to prevent todos removal in case of a mistake @@ -90,12 +81,27 @@ module Issues end end + def handle_assignee_changes(issue, old_assignees) + return if issue.assignees == old_assignees + + create_assignee_note(issue, old_assignees) + notification_service.async.reassigned_issue(issue, current_user, old_assignees) + todo_service.reassigned_assignable(issue, current_user, old_assignees) + track_incident_action(current_user, issue, :incident_assigned) + + if Gitlab::ActionCable::Config.in_app? || Feature.enabled?(:broadcast_issue_updates, issue.project) + GraphqlTriggers.issuable_assignees_updated(issue) + end + end + def handle_task_changes(issuable) todo_service.resolve_todos_for_target(issuable, current_user) todo_service.update_issue(issuable, current_user) end def handle_move_between_ids(issue) + issue.check_repositioning_allowed! if params[:move_between_ids] + super rebalance_if_needed(issue) @@ -113,7 +119,7 @@ module Issues canonical_issue = IssuesFinder.new(current_user).find_by(id: canonical_issue_id) if canonical_issue - Issues::DuplicateService.new(project, current_user).execute(issue, canonical_issue) + Issues::DuplicateService.new(project: project, current_user: current_user).execute(issue, canonical_issue) end end # rubocop: enable CodeReuse/ActiveRecord @@ -126,7 +132,7 @@ module Issues target_project != issue.project update(issue) - Issues::MoveService.new(project, current_user).execute(issue, target_project) + Issues::MoveService.new(project: project, current_user: current_user).execute(issue, target_project) end private @@ -142,14 +148,14 @@ module Issues # we've pre-empted this from running in #execute, so let's go ahead and update the Issue now. update(issue) - Issues::CloneService.new(project, current_user).execute(issue, target_project, with_notes: with_notes) + Issues::CloneService.new(project: project, current_user: current_user).execute(issue, target_project, with_notes: with_notes) end def create_merge_request_from_quick_action create_merge_request_params = params.delete(:create_merge_request) return unless create_merge_request_params - MergeRequests::CreateFromIssueService.new(project, current_user, create_merge_request_params).execute + MergeRequests::CreateFromIssueService.new(project: project, current_user: current_user, mr_params: create_merge_request_params).execute end def handle_milestone_change(issue) @@ -201,4 +207,4 @@ module Issues end end -Issues::UpdateService.prepend_if_ee('EE::Issues::UpdateService') +Issues::UpdateService.prepend_mod_with('Issues::UpdateService') |