5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 01:46:21 +00:00

feat: al moderar una cuenta, también moderar sus comentarios

This commit is contained in:
f 2024-03-08 15:31:41 -03:00
parent 6b74bc454d
commit 071102fa3b
No known key found for this signature in database
3 changed files with 20 additions and 4 deletions

View file

@ -42,19 +42,35 @@ class ActorModeration < ApplicationRecord
end end
end end
# Al permitir una cuenta se permiten todos los comentarios
# pendientes de moderación que ya hizo.
event :allow do event :allow do
transitions from: %i[paused blocked reported], to: :allowed transitions from: %i[paused blocked reported], to: :allowed
before do before do
allow_remotely! 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
end end
# Al bloquear una cuenta se bloquean todos los comentarios
# pendientes de moderación que hizo.
event :block do event :block do
transitions from: %i[paused allowed], to: :blocked transitions from: %i[paused allowed], to: :blocked
before do before do
block_remotely! 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
end end

View file

@ -138,10 +138,10 @@ en:
success: "Account paused. All of their comments will need to be moderated individually on the Comments section." 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." error: "There was an error while pausing the account. We received a report and will be acting on it soon."
allow: 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." error: "There was an error while allowing the account. We received a report and will be acting on it soon."
block: 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." error: "There was an error while blocking the account. We received a report and will be acting on it soon."
report: report:
success: "Account reported." success: "Account reported."

View file

@ -137,10 +137,10 @@ es:
success: "Cuenta pausada. Todos los comentarios que haga necesitan ser aprobados manualmente en la sección Comentarios." 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." error: "No se pudo pausar la cuenta. Hemos recibido el reporte y lo estaremos verificando."
allow: 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." error: "No se pudo permitir la cuenta. Hemos recibido el reporte y lo estaremos verificando."
block: 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." error: "No se pudo bloquear la cuenta. Hemos recibido el reporte y lo estaremos verificando."
report: report:
success: "Cuenta reportada a su instancia." success: "Cuenta reportada a su instancia."