From aae04f3739c1cd07a4518922d8ff2cbac66180ac Mon Sep 17 00:00:00 2001 From: f Date: Wed, 28 Feb 2024 11:54:41 -0300 Subject: [PATCH] feat: al activar el fediverso, activar las listas de bloqueo --- app/models/deploy_social_distributed_press.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/models/deploy_social_distributed_press.rb b/app/models/deploy_social_distributed_press.rb index 7f761e46..9f968f36 100644 --- a/app/models/deploy_social_distributed_press.rb +++ b/app/models/deploy_social_distributed_press.rb @@ -8,6 +8,7 @@ class DeploySocialDistributedPress < Deploy DEPENDENCIES = %i[deploy_distributed_press deploy_rsync deploy_full_rsync].freeze after_save :create_hooks! + after_create :enable_fediblocks! # EnvĂ­a las notificaciones def deploy(output: false) @@ -95,4 +96,16 @@ class DeploySocialDistributedPress < Deploy ExceptionNotifier.notify_exception(e, data: { site_id: site.name, usuarie_id: rol.usuarie_id }) end end + + # Habilita todos los fediblocks disponibles. + # + # @todo Hacer que algunos sean opcionales + # @todo Mover a un Job + def enable_fediblocks! + ActivityPub::Fediblock.find_each do |fediblock| + site.fediblock_states.find_or_create_by(fediblock: fediblock).tap do |state| + state.enable! if state.may_enable? + end + end + end end