about summary refs log tree commit diff
path: root/app/controllers/api/v1
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2022-10-23 01:30:55 +0900
committerGitHub <noreply@github.com>2022-10-22 18:30:55 +0200
commit74ead7d10698c7f18ca22c07d2f04ff81f419097 (patch)
tree3bc7504ab88d44bbc28c0bb1dfa40a85963d65dd /app/controllers/api/v1
parent73a48318a19a207c63f6d03ecea8ce35b7e2364a (diff)
Change featured tag updates to add/remove activity (#19409)
* Change featured tag updates to add/remove activity

* Fix to check for the existence of feature tag

* Rename service and worker

* Merge AddHashtagSerializer with AddSerializer

* Undo removal of sidekiq_options
Diffstat (limited to 'app/controllers/api/v1')
-rw-r--r--app/controllers/api/v1/featured_tags_controller.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/controllers/api/v1/featured_tags_controller.rb b/app/controllers/api/v1/featured_tags_controller.rb
index a67db7040..edb42a94e 100644
--- a/app/controllers/api/v1/featured_tags_controller.rb
+++ b/app/controllers/api/v1/featured_tags_controller.rb
@@ -13,14 +13,12 @@ class Api::V1::FeaturedTagsController < Api::BaseController
   end
 
   def create
-    @featured_tag = current_account.featured_tags.create!(featured_tag_params)
-    ActivityPub::UpdateDistributionWorker.perform_in(3.minutes, current_account.id)
-    render json: @featured_tag, serializer: REST::FeaturedTagSerializer
+    featured_tag = CreateFeaturedTagService.new.call(current_account, featured_tag_params[:name])
+    render json: featured_tag, serializer: REST::FeaturedTagSerializer
   end
 
   def destroy
-    @featured_tag.destroy!
-    ActivityPub::UpdateDistributionWorker.perform_in(3.minutes, current_account.id)
+    RemoveFeaturedTagWorker.perform_async(current_account.id, @featured_tag.id)
     render_empty
   end