mirror of
https://github.com/mastodon/mastodon.git
synced 2026-03-21 18:05:23 -05:00
21 lines
576 B
Ruby
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
|