mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 04:36:21 +00:00
feat: aprobar o rechazar actividades
This commit is contained in:
parent
b798980865
commit
ccd3df2038
1 changed files with 13 additions and 1 deletions
|
@ -64,14 +64,26 @@ class ActivityPub < ApplicationRecord
|
||||||
transitions from: %i[approved rejected], to: :paused
|
transitions from: %i[approved rejected], to: :paused
|
||||||
end
|
end
|
||||||
|
|
||||||
# La actividad se aprueba
|
# La actividad se aprueba, informándole a la Social Inbox que está
|
||||||
|
# aprobada. También recibimos la aprobación via
|
||||||
|
# webhook a modo de confirmación.
|
||||||
event :approve do
|
event :approve do
|
||||||
transitions from: %i[paused rejected], to: :approved
|
transitions from: %i[paused rejected], to: :approved
|
||||||
|
|
||||||
|
before do
|
||||||
|
raise AASM::InvalidTransition unless
|
||||||
|
site.social_inbox.inbox.accept(id: object.uri).ok?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# La actividad fue rechazada
|
# La actividad fue rechazada
|
||||||
event :reject do
|
event :reject do
|
||||||
transitions from: %i[paused approved], to: :rejected
|
transitions from: %i[paused approved], to: :rejected
|
||||||
|
|
||||||
|
before do
|
||||||
|
raise AASM::InvalidTransition unless
|
||||||
|
site.social_inbox.inbox.reject(id: object.uri).ok?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Solo podemos reportarla luego de rechazarla
|
# Solo podemos reportarla luego de rechazarla
|
||||||
|
|
Loading…
Reference in a new issue