mastodon/app/services/delete_collection_service.rb
2026-02-05 10:33:39 +00:00

21 lines
576 B
Ruby

# frozen_string_literal: true
class DeleteCollectionService
def call(collection)
@collection = collection
@collection.destroy!
distribute_remove_activity if Mastodon::Feature.collections_federation_enabled?
end
private
def distribute_remove_activity
ActivityPub::AccountRawDistributionWorker.perform_async(activity_json, @collection.account.id)
end
def activity_json
ActiveModelSerializers::SerializableResource.new(@collection, serializer: ActivityPub::RemoveFeaturedCollectionSerializer, adapter: ActivityPub::Adapter).to_json
end
end