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 'lib/api/topics.rb')
-rw-r--r--lib/api/topics.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/topics.rb b/lib/api/topics.rb
index a08b4c6c107..38cfdc44021 100644
--- a/lib/api/topics.rb
+++ b/lib/api/topics.rb
@@ -94,5 +94,25 @@ module API
destroy_conditionally!(topic)
end
+
+ desc 'Merge topics' do
+ detail 'This feature was introduced in GitLab 15.4.'
+ success Entities::Projects::Topic
+ end
+ params do
+ requires :source_topic_id, type: Integer, desc: 'ID of source project topic'
+ requires :target_topic_id, type: Integer, desc: 'ID of target project topic'
+ end
+ post 'topics/merge' do
+ authenticated_as_admin!
+
+ source_topic = ::Projects::Topic.find(params[:source_topic_id])
+ target_topic = ::Projects::Topic.find(params[:target_topic_id])
+
+ response = ::Topics::MergeService.new(source_topic, target_topic).execute
+ render_api_error!(response.message, :bad_request) if response.error?
+
+ present target_topic, with: Entities::Projects::Topic
+ end
end
end