mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 09:46:22 +00:00
fix: eliminar actores cuando no se pudo completar el objeto #15576
This commit is contained in:
parent
b6ed91df11
commit
9d71c5fa0c
2 changed files with 17 additions and 2 deletions
|
@ -24,8 +24,8 @@ class ActivityPub
|
||||||
|
|
||||||
# Encontrar todas las acciones de moderación de le actore
|
# Encontrar todas las acciones de moderación de le actore
|
||||||
# eliminade y moverlas a eliminar.
|
# eliminade y moverlas a eliminar.
|
||||||
if object.actor_type? && object.actor.present?
|
if (actor = ActivityPub::Actor.find_by(uri: o.uri)).present?
|
||||||
ActorModeration.where(actor_id: object.actor.id).remove_all!
|
ActorModeration.where(actor_id: actor.id).remove_all!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Elimina actores que no pudieron ser eliminades porque su perfil ya no
|
||||||
|
# existe.
|
||||||
|
class RemoveActorModerationsForGenericObjects < ActiveRecord::Migration[6.1]
|
||||||
|
def up
|
||||||
|
object_ids = ActivityPub.removed.where(object_type: 'ActivityPub::Object::Generic').distinct.pluck(:object_id)
|
||||||
|
uris = ActivityPub::Object.where(id: object_ids).pluck(:uri)
|
||||||
|
actor_ids = ActivityPub::Actor.where(uri: uris).ids
|
||||||
|
|
||||||
|
ActorModeration.where(actor_id: actor_ids).remove_all!
|
||||||
|
end
|
||||||
|
|
||||||
|
def down; end
|
||||||
|
end
|
Loading…
Reference in a new issue