diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-19 23:18:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-19 23:18:09 +0000 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /app/controllers/admin/topics_controller.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) | |
download | gitlab-ce-6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde.tar.gz |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'app/controllers/admin/topics_controller.rb')
-rw-r--r-- | app/controllers/admin/topics_controller.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/app/controllers/admin/topics_controller.rb b/app/controllers/admin/topics_controller.rb index 69bcfdf4791..e97ead12f71 100644 --- a/app/controllers/admin/topics_controller.rb +++ b/app/controllers/admin/topics_controller.rb @@ -49,16 +49,12 @@ class Admin::TopicsController < Admin::ApplicationController source_topic = Projects::Topic.find(merge_params[:source_topic_id]) target_topic = Projects::Topic.find(merge_params[:target_topic_id]) - begin - ::Topics::MergeService.new(source_topic, target_topic).execute - rescue ArgumentError => e - return render status: :bad_request, json: { type: :alert, message: e.message } - end + response = ::Topics::MergeService.new(source_topic, target_topic).execute + return render status: :bad_request, json: { type: :alert, message: response.message } if response.error? message = _('Topic %{source_topic} was successfully merged into topic %{target_topic}.') - redirect_to admin_topics_path, - status: :found, - notice: message % { source_topic: source_topic.name, target_topic: target_topic.name } + flash[:toast] = message % { source_topic: source_topic.name, target_topic: target_topic.name } + redirect_to admin_topics_path, status: :found end private |