Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot
2023-11-29 12:14:14 +00:00
parent 3396d8eca0
commit fb28ad5316
33 changed files with 331 additions and 26 deletions

View File

@ -33,6 +33,8 @@ module Gitlab
record: create_note,
invalid_exception: InvalidNoteError,
record_name: 'comment')
reopen_issue_on_external_participant_note
end
def metrics_event
@ -71,6 +73,34 @@ module Gitlab
raise UserNotFoundError unless from_address && author.verified_email?(from_address)
end
def reopen_issue_on_external_participant_note
return unless noteable.closed?
return unless author == Users::Internal.support_bot
return unless project.service_desk_setting&.reopen_issue_on_external_participant_note?
::Notes::CreateService.new(
project,
Users::Internal.support_bot,
noteable: noteable,
note: build_reopen_message,
confidential: true
).execute
end
def build_reopen_message
translated_text = s_(
"ServiceDesk|This issue has been reopened because it received a new comment from an external participant."
)
"#{assignees_references} :wave: #{translated_text}\n/reopen".lstrip
end
def assignees_references
return unless noteable.assignees.any?
noteable.assignees.map(&:to_reference).join(' ')
end
end
end
end