Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/issues')
-rw-r--r--app/services/issues/base_service.rb5
-rw-r--r--app/services/issues/close_service.rb13
-rw-r--r--app/services/issues/create_service.rb2
-rw-r--r--app/services/issues/move_service.rb13
-rw-r--r--app/services/issues/update_service.rb2
5 files changed, 29 insertions, 6 deletions
diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb
index 28ea6b0ebf8..10407e99715 100644
--- a/app/services/issues/base_service.rb
+++ b/app/services/issues/base_service.rb
@@ -114,6 +114,11 @@ module Issues
Milestones::IssuesCountService.new(milestone).delete_cache
end
+
+ override :allowed_create_params
+ def allowed_create_params(params)
+ super(params).except(:issue_type, :work_item_type_id, :work_item_type)
+ end
end
end
diff --git a/app/services/issues/close_service.rb b/app/services/issues/close_service.rb
index da888386e0a..4f6a859e20e 100644
--- a/app/services/issues/close_service.rb
+++ b/app/services/issues/close_service.rb
@@ -56,7 +56,7 @@ module Issues
end
def perform_incident_management_actions(issue)
- resolve_alert(issue)
+ resolve_alerts(issue)
resolve_incident(issue)
end
@@ -71,12 +71,17 @@ module Issues
SystemNoteService.change_status(issue, issue.project, current_user, issue.state, current_commit)
end
- def resolve_alert(issue)
- return unless alert = issue.alert_management_alert
+ def resolve_alerts(issue)
+ issue.alert_management_alerts.each { |alert| resolve_alert(alert) }
+ end
+
+ def resolve_alert(alert)
return if alert.resolved?
+ issue = alert.issue
+
if alert.resolve
- SystemNoteService.change_alert_status(alert, current_user, " by closing incident #{issue.to_reference(project)}")
+ SystemNoteService.change_alert_status(alert, User.alert_bot, " because #{current_user.to_reference} closed incident #{issue.to_reference(project)}")
else
Gitlab::AppLogger.warn(
message: 'Cannot resolve an associated Alert Management alert',
diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb
index 89b35bbab24..afad8d0c6bf 100644
--- a/app/services/issues/create_service.rb
+++ b/app/services/issues/create_service.rb
@@ -13,7 +13,7 @@ module Issues
# spam_checking is likely to be necessary. However, if there is not a request available in scope
# in the caller (for example, an issue created via email) and the required arguments to the
# SpamParams constructor are not otherwise available, spam_params: must be explicitly passed as nil.
- def initialize(project:, current_user: nil, params: {}, spam_params:, build_service: nil)
+ def initialize(project:, spam_params:, current_user: nil, params: {}, build_service: nil)
@extra_params = params.delete(:extra_params) || {}
super(project: project, current_user: current_user, params: params)
@spam_params = spam_params
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb
index 6366ff4076b..f7f7d85611b 100644
--- a/app/services/issues/move_service.rb
+++ b/app/services/issues/move_service.rb
@@ -19,6 +19,7 @@ module Issues
# to receive service desk emails on the new moved issue.
update_service_desk_sent_notifications
+ copy_email_participants
queue_copy_designs
new_entity
@@ -49,6 +50,18 @@ module Issues
.sent_notifications.update_all(project_id: new_entity.project_id, noteable_id: new_entity.id)
end
+ def copy_email_participants
+ new_attributes = { id: nil, issue_id: new_entity.id }
+
+ new_participants = original_entity.issue_email_participants.dup
+
+ new_participants.each do |participant|
+ participant.assign_attributes(new_attributes)
+ end
+
+ IssueEmailParticipant.bulk_insert!(new_participants)
+ end
+
override :update_old_entity
def update_old_entity
super
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb
index 0aed9e3ba40..71cc5581ae6 100644
--- a/app/services/issues/update_service.rb
+++ b/app/services/issues/update_service.rb
@@ -146,7 +146,7 @@ module Issues
# don't enqueue immediately to prevent todos removal in case of a mistake
TodosDestroyer::ConfidentialIssueWorker.perform_in(Todo::WAIT_FOR_DELETE, issue.id) if issue.confidential?
create_confidentiality_note(issue)
- track_usage_event(:incident_management_incident_change_confidential, current_user.id)
+ track_incident_action(current_user, issue, :incident_change_confidential)
end
end