mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Handle Delete of a FeatureAuthorization (#38292)
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
|
||||
class ActivityPub::Activity::Delete < ActivityPub::Activity
|
||||
def perform
|
||||
if @account.uri == object_uri
|
||||
delete_person
|
||||
else
|
||||
delete_object
|
||||
end
|
||||
return delete_person if @account.uri == object_uri
|
||||
return delete_feature_authorization! unless !Mastodon::Feature.collections_federation_enabled? || feature_authorization_from_object.nil?
|
||||
|
||||
delete_object
|
||||
end
|
||||
|
||||
private
|
||||
@@ -66,7 +65,18 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
|
||||
DistributionWorker.perform_async(@quote.status_id, { 'update' => true }) if @quote.status.present?
|
||||
end
|
||||
|
||||
def delete_feature_authorization!
|
||||
collection_item = feature_authorization_from_object
|
||||
DeleteCollectionItemService.new.call(collection_item, revoke: true)
|
||||
end
|
||||
|
||||
def forwarder
|
||||
@forwarder ||= ActivityPub::Forwarder.new(@account, @json, @status)
|
||||
end
|
||||
|
||||
def feature_authorization_from_object
|
||||
return @collection_item if instance_variable_defined?(:@collection_item)
|
||||
|
||||
@collection_item = CollectionItem.local.find_by(approval_uri: value_or_id(@object), account_id: @account.id)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user