about summary refs log tree commit diff
path: root/app/services/remove_featured_tag_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/remove_featured_tag_service.rb')
-rw-r--r--app/services/remove_featured_tag_service.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/services/remove_featured_tag_service.rb b/app/services/remove_featured_tag_service.rb
new file mode 100644
index 000000000..2aa70e8fc
--- /dev/null
+++ b/app/services/remove_featured_tag_service.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveFeaturedTagService < BaseService
+  include Payloadable
+
+  def call(account, featured_tag)
+    @account = account
+
+    featured_tag.destroy!
+    ActivityPub::AccountRawDistributionWorker.perform_async(build_json(featured_tag), account.id) if @account.local?
+  end
+
+  private
+
+  def build_json(featured_tag)
+    Oj.dump(serialize_payload(featured_tag, ActivityPub::RemoveSerializer, signer: @account))
+  end
+end