From 071102fa3b82247fd7601f4548c3947106b6fd63 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 8 Mar 2024 15:31:41 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20al=20moderar=20una=20cuenta,=20tambi?= =?UTF-8?q?=C3=A9n=20moderar=20sus=20comentarios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/actor_moderation.rb | 16 ++++++++++++++++ config/locales/en.yml | 4 ++-- config/locales/es.yml | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/models/actor_moderation.rb b/app/models/actor_moderation.rb index 01613f72..4b220a58 100644 --- a/app/models/actor_moderation.rb +++ b/app/models/actor_moderation.rb @@ -42,19 +42,35 @@ class ActorModeration < ApplicationRecord end end + # Al permitir una cuenta se permiten todos los comentarios + # pendientes de moderación que ya hizo. event :allow do transitions from: %i[paused blocked reported], to: :allowed before do allow_remotely! + + site.activity_pubs.paused.where(actor_id: self.actor_id).find_each do |activity_pub| + activity_pub.allow! if activity_pub.may_allow? + rescue Exception => e + ExceptionNotifier.notify_exception(e, data: { site: site.name, activity_pub: activity_pub_id }) + end end end + # Al bloquear una cuenta se bloquean todos los comentarios + # pendientes de moderación que hizo. event :block do transitions from: %i[paused allowed], to: :blocked before do block_remotely! + + site.activity_pubs.paused.where(actor_id: self.actor_id).find_each do |activity_pub| + activity_pub.reject! if activity_pub.may_reject? + rescue Exception => e + ExceptionNotifier.notify_exception(e, data: { site: site.name, activity_pub: activity_pub_id }) + end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 73920b57..48d9ca61 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -138,10 +138,10 @@ en: success: "Account paused. All of their comments will need to be moderated individually on the Comments section." error: "There was an error while pausing the account. We received a report and will be acting on it soon." allow: - success: "Account allowed. All of their comments will be approved automatically." + success: "Account allowed. All of their comments will be approved automatically. Any pending comments have been approved." error: "There was an error while allowing the account. We received a report and will be acting on it soon." block: - success: "Account blocked. All of their comments will be rejected automatically. If you want to report it to their instance, please use the Report button." + success: "Account blocked. All of their comments will be rejected automatically. Any pending comments have been rejected. If you want to report it to their instance, please use the Report button." error: "There was an error while blocking the account. We received a report and will be acting on it soon." report: success: "Account reported." diff --git a/config/locales/es.yml b/config/locales/es.yml index 467f15e8..3df608f5 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -137,10 +137,10 @@ es: success: "Cuenta pausada. Todos los comentarios que haga necesitan ser aprobados manualmente en la sección Comentarios." error: "No se pudo pausar la cuenta. Hemos recibido el reporte y lo estaremos verificando." allow: - success: "Cuenta permitida. Todos los comentarios que haga serán aprobados inmediatamente." + success: "Cuenta permitida. Todos los comentarios que haga serán aprobados inmediatamente. Todos los comentarios pendientes de moderación fueron aprobados." error: "No se pudo permitir la cuenta. Hemos recibido el reporte y lo estaremos verificando." block: - success: "Cuenta bloqueada. Todos los comentarios que haga serán rechazados inmediatamente. Si querés reportarla a su instancia, podés usar el botón Reportar." + success: "Cuenta bloqueada. Todos los comentarios que haga serán rechazados inmediatamente. Todos los comentarios pendientes de moderación fueron rechazados. Si querés reportarla a su instancia, podés usar el botón Reportar." error: "No se pudo bloquear la cuenta. Hemos recibido el reporte y lo estaremos verificando." report: success: "Cuenta reportada a su instancia."