mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-19 14:36:21 +00:00
feat: al eliminar una actividad, vaciar su objeto
This commit is contained in:
parent
9fa4335314
commit
88e93e3b5b
2 changed files with 18 additions and 1 deletions
|
@ -29,5 +29,16 @@ class ActivityPub < ApplicationRecord
|
|||
state :reported
|
||||
# Le actore eliminó el objeto
|
||||
state :deleted
|
||||
|
||||
# Recibir una acción de eliminación, eliminar el contenido de la
|
||||
# base de datos. Esto elimina el contenido para todos los sitios
|
||||
# porque estamos respetando lo que pidió le actore.
|
||||
event :delete do
|
||||
transitions to: :deleted
|
||||
|
||||
after do
|
||||
object.update(object: {})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ActivityPub::Activity::Delete < ActivityPub::Activity; end
|
||||
class ActivityPub::Activity::Delete < ActivityPub::Activity
|
||||
# Si estamos eliminando el objeto, tenemos que vaciar su contenido y
|
||||
# cambiar el estado a borrado
|
||||
def update_activity_pub_state!
|
||||
activity_pub.deleted!
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue