diff --git a/app/controllers/api/v1/webhooks/social_inbox_controller.rb b/app/controllers/api/v1/webhooks/social_inbox_controller.rb index 76c7ec40..20028708 100644 --- a/app/controllers/api/v1/webhooks/social_inbox_controller.rb +++ b/app/controllers/api/v1/webhooks/social_inbox_controller.rb @@ -47,6 +47,10 @@ module Api # Cuando rechazamos una actividad, recibimos la confirmaciĆ³n y # cambiamos el estado def onrejected + ActivityPub.transaction do + activity_pub.reject! if activity_pub.waiting? + end + head :accepted end diff --git a/app/models/activity_pub.rb b/app/models/activity_pub.rb index 71d67722..b8e8eded 100644 --- a/app/models/activity_pub.rb +++ b/app/models/activity_pub.rb @@ -53,5 +53,10 @@ class ActivityPub < ApplicationRecord event :approve do transitions from: :waiting, to: :approved end + + # La actividad fue rechazada + event :reject do + transitions from: :waiting, to: :rejected + end end end