about summary refs log tree commit diff
path: root/app/controllers/settings/featured_tags_controller.rb
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2022-10-23 06:14:58 +0900
committerGitHub <noreply@github.com>2022-10-22 23:14:58 +0200
commit45d3b324883c1e72ad5f9820d3c23f7f779f28db (patch)
treebc9e7e7882f2c06ca6f99d21d6dcbcd7e6cc469d /app/controllers/settings/featured_tags_controller.rb
parent74ead7d10698c7f18ca22c07d2f04ff81f419097 (diff)
Fix `Settings::FeaturedTagsController` (#19418)
Regression from #19409
Diffstat (limited to 'app/controllers/settings/featured_tags_controller.rb')
-rw-r--r--app/controllers/settings/featured_tags_controller.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/controllers/settings/featured_tags_controller.rb b/app/controllers/settings/featured_tags_controller.rb
index cc6ec0843..b3db04a42 100644
--- a/app/controllers/settings/featured_tags_controller.rb
+++ b/app/controllers/settings/featured_tags_controller.rb
@@ -10,8 +10,9 @@ class Settings::FeaturedTagsController < Settings::BaseController
   end
 
   def create
-    if !featured_tag_exists?
-      CreateFeaturedTagService.new.call(current_account, featured_tag_params[:name])
+    @featured_tag = CreateFeaturedTagService.new.call(current_account, featured_tag_params[:name], force: false)
+
+    if @featured_tag.valid?
       redirect_to settings_featured_tags_path
     else
       set_featured_tags
@@ -28,10 +29,6 @@ class Settings::FeaturedTagsController < Settings::BaseController
 
   private
 
-  def featured_tag_exists?
-    current_account.featured_tags.by_name(featured_tag_params[:name]).exists?
-  end
-
   def set_featured_tag
     @featured_tag = current_account.featured_tags.find(params[:id])
   end