From 0a1b86c11195af3a5ecaa2002173caa95bd0954e Mon Sep 17 00:00:00 2001 From: f Date: Wed, 20 Mar 2024 17:49:09 -0300 Subject: [PATCH 1/5] fix: se pueden rechazar comentarios luego de aprobarlos #15600 --- app/models/activity_pub.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/activity_pub.rb b/app/models/activity_pub.rb index 913ac67d..335121d2 100644 --- a/app/models/activity_pub.rb +++ b/app/models/activity_pub.rb @@ -128,7 +128,7 @@ class ActivityPub < ApplicationRecord # La actividad fue rechazada event :reject do - transitions from: %i[paused], to: :rejected + transitions from: %i[paused approved], to: :rejected after do ActivityPub::InboxJob.perform_later(site: site, activity: activities.first.uri, action: :reject) From 0578b03ee76f8094c1b7a9fa6ee4fbb491b2503c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 20 Mar 2024 17:50:39 -0300 Subject: [PATCH 2/5] fix: reportar implicar bloquear #15600 --- app/models/activity_pub.rb | 5 +++-- app/models/actor_moderation.rb | 2 +- config/locales/en.yml | 4 ++-- config/locales/es.yml | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/models/activity_pub.rb b/app/models/activity_pub.rb index 335121d2..cd893406 100644 --- a/app/models/activity_pub.rb +++ b/app/models/activity_pub.rb @@ -135,11 +135,12 @@ class ActivityPub < ApplicationRecord end end - # Solo podemos reportarla luego de rechazarla + # Reportarla implica rechazarla event :report do - transitions from: :rejected, to: :reported + transitions from: %i[paused approved rejected], to: :reported after do + ActivityPub::InboxJob.perform_later(site: site, activity: activities.first.uri, action: :reject) ActivityPub::RemoteFlagJob.perform_later(remote_flag: remote_flag) if remote_flag.waiting? end end diff --git a/app/models/actor_moderation.rb b/app/models/actor_moderation.rb index 18149be4..1c3cf83a 100644 --- a/app/models/actor_moderation.rb +++ b/app/models/actor_moderation.rb @@ -43,7 +43,7 @@ class ActorModeration < ApplicationRecord # Al reportar, necesitamos asociar una RemoteFlag para poder # enviarla. event :report do - transitions from: %i[blocked], to: :reported + transitions from: %i[pause allowed blocked], to: :reported, after: :synchronize! after do ActivityPub::RemoteFlagJob.perform_later(remote_flag: remote_flag) if remote_flag.waiting? diff --git a/config/locales/en.yml b/config/locales/en.yml index 35b857e6..643effaf 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -106,7 +106,7 @@ en: text_reject: Reject text_reply: Reply text_report: Report - confirm_report: "Send report to the remote instance?" + confirm_report: "Send report to the remote instance? This action will also reject the comment." instances_btn_box: text_pause: Check case by case text_allow: Allow everything @@ -116,7 +116,7 @@ en: text_allow: Always approve text_block: Block text_report: Report - confirm_report: "Send report to the remote instance?" + confirm_report: "Send report to the remote instance? This action will also block the account." remote_flags: report_message: "Hi! Someone using Sutty CMS reported this account on your instance. We don't have support for customized report messages yet, but we will soon. You can reach us at %{panel_actor_mention}." activity_pubs: diff --git a/config/locales/es.yml b/config/locales/es.yml index 77e611ed..b8bfc524 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -105,7 +105,7 @@ es: text_approve: Aceptar text_reject: Rechazar text_report: Reportar - confirm_report: "¿Enviar el reporte a la instancia remota?" + confirm_report: "¿Enviar el reporte a la instancia remota? Esta acción también rechazará el comentario." instances_btn_box: text_pause: Moderar caso por caso text_allow: Permitir todo @@ -115,7 +115,7 @@ es: text_allow: Aprobar siempre text_block: Bloquear text_report: Reportar - confirm_report: "¿Enviar el reporte a la instancia remota?" + confirm_report: "¿Enviar el reporte a la instancia remota? Esta acción también bloqueará la cuenta." remote_flags: report_message: "¡Hola! Une usuarie de Sutty CMS reportó esta cuenta en tu instancia. Todavía no tenemos soporte para mensajes personalizados. Podés contactarnos en %{panel_actor_mention}." activity_pubs: From e2fdce91f3b2cbfa110559ac2e0b01ef0333ab21 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 20 Mar 2024 17:51:23 -0300 Subject: [PATCH 3/5] fix: agrupar espacialmente acciones #15600 --- app/views/components/_comments_filters.haml | 2 +- app/views/components/_instances_filters.haml | 2 +- app/views/components/_profiles_filters.haml | 2 +- app/views/moderation_queue/_comment.haml | 2 +- config/locales/en.yml | 6 +++--- config/locales/es.yml | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/components/_comments_filters.haml b/app/views/components/_comments_filters.haml index cf8c1aa2..b2870c5a 100644 --- a/app/views/components/_comments_filters.haml +++ b/app/views/components/_comments_filters.haml @@ -3,7 +3,7 @@ - current_state = params[:activity_pub_state]&.to_sym || ActivityPub.states.first -.d-flex.py-2 +.d-flex.flex-row.justify-content-between.py-2 - if ActivityPub.transitionable_events(current_state).present? = render 'components/dropdown', text: t('.text_checked') do = render 'components/comments_checked_submenu', form: form diff --git a/app/views/components/_instances_filters.haml b/app/views/components/_instances_filters.haml index 730184bd..f2296c7b 100644 --- a/app/views/components/_instances_filters.haml +++ b/app/views/components/_instances_filters.haml @@ -3,7 +3,7 @@ - current_state = params[:state]&.to_sym || InstanceModeration.states.first -.d-flex.py-2 +.d-flex.flex-row.justify-content-between.py-2 - if InstanceModeration.transitionable_events(current_state).present? = render 'components/dropdown', text: t('.text_checked') do = render 'components/instances_checked_submenu', form: form, current_state: current_state diff --git a/app/views/components/_profiles_filters.haml b/app/views/components/_profiles_filters.haml index 3f830ec8..c2670944 100644 --- a/app/views/components/_profiles_filters.haml +++ b/app/views/components/_profiles_filters.haml @@ -3,7 +3,7 @@ - current_state = params[:actor_state]&.to_sym || ActorModeration.states.first -.d-flex.py-2 +.d-flex.flex-row.justify-content-between.py-2 - if ActorModeration.transitionable_events(current_state).present? = render 'components/dropdown', text: t('.text_checked') do = render 'components/profiles_checked_submenu', form: form, current_state: current_state diff --git a/app/views/moderation_queue/_comment.haml b/app/views/moderation_queue/_comment.haml index 10f09106..a80bd27c 100644 --- a/app/views/moderation_queue/_comment.haml +++ b/app/views/moderation_queue/_comment.haml @@ -38,7 +38,7 @@ %dd.d-inline %small %a{ href: in_reply_to }= in_reply_to - .content + .content.mb-3 - if summary.present? = render 'layouts/details', summary: summary, summary_class: 'h5' do = sanitize comment['content'] diff --git a/config/locales/en.yml b/config/locales/en.yml index 643effaf..8059b6db 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -63,7 +63,7 @@ en: instances_blocked: Instances blocked instances_filters: text_show: Show - text_checked: With selected + text_checked: With selected... instances_checked_submenu: submenu_pause: Moderate submenu_allow: Allow @@ -74,7 +74,7 @@ en: submenu_blocked: "Blocked (%{count})" comments_filters: text_show: Show - text_checked: With selected + text_checked: With selected... comments_checked_submenu: submenu_pause: Pause submenu_approve: Approve @@ -87,7 +87,7 @@ en: submenu_reported: "Reported (%{count})" profiles_filters: text_show: Show - text_checked: With selected + text_checked: With selected... profiles_checked_submenu: submenu_pause: Pause submenu_allow: Allow diff --git a/config/locales/es.yml b/config/locales/es.yml index b8bfc524..06b933bc 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -63,7 +63,7 @@ es: instances_blocked: Instancias bloqueadas instances_filters: text_show: Ver - text_checked: Con los marcados + text_checked: Con los marcados... instances_checked_submenu: submenu_pause: Moderar caso por caso submenu_allow: Permitir todo @@ -74,7 +74,7 @@ es: submenu_blocked: "Bloqueadas (%{count})" comments_filters: text_show: Ver - text_checked: Con los marcados + text_checked: Con los marcados... comments_checked_submenu: submenu_pause: Pausar submenu_approve: Aprobar @@ -87,7 +87,7 @@ es: submenu_reported: "Reportados (%{count})" profiles_filters: text_show: Ver - text_checked: Con los marcados + text_checked: Con los marcados... profiles_checked_submenu: submenu_pause: Pausar submenu_allow: Aceptar From eda075fd4b889707328c2c62bcc6ac47984944ee Mon Sep 17 00:00:00 2001 From: f Date: Wed, 20 Mar 2024 17:52:31 -0300 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20la=20acci=C3=B3n=20no=20se=20puede?= =?UTF-8?q?=20hacer=20porque=20es=20el=20estado=20actual=20#15600?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/components/_btn_base.haml | 1 - app/views/components/_comments_btn_box.haml | 4 +++- app/views/components/_instances_btn_box.haml | 5 +++-- app/views/components/_profiles_btn_box.haml | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/views/components/_btn_base.haml b/app/views/components/_btn_base.haml index faa5c85f..fed3254c 100644 --- a/app/views/components/_btn_base.haml +++ b/app/views/components/_btn_base.haml @@ -1,7 +1,6 @@ -# Componente Botón general Moderación - local_assigns[:method] ||= 'patch' -- local_assigns[:class] ||= 'btn-secondary' - local_assigns[:class] = "btn #{local_assigns[:class]}" - local_assigns.delete(:text) diff --git a/app/views/components/_comments_btn_box.haml b/app/views/components/_comments_btn_box.haml index 1993e5cb..ffc773a7 100644 --- a/app/views/components/_comments_btn_box.haml +++ b/app/views/components/_comments_btn_box.haml @@ -4,8 +4,10 @@ .d-flex.flex-row - ActivityPub.events.each do |event| + - possible = activity_pub.public_send(:"may_#{event}?") = render 'components/btn_base', text: t(".text_#{event}"), path: public_send(:"site_activity_pub_#{event}_path", activity_pub_id: activity_pub), - disabled: !activity_pub.public_send(:"may_#{event}?"), + class: ('btn-secondary' if possible), + disabled: !possible, data: local_data[event] diff --git a/app/views/components/_instances_btn_box.haml b/app/views/components/_instances_btn_box.haml index 15c6c040..8c3a5f88 100644 --- a/app/views/components/_instances_btn_box.haml +++ b/app/views/components/_instances_btn_box.haml @@ -2,9 +2,10 @@ - local_data = {} - InstanceModeration.events.each do |event| + - possible = instance_moderation.public_send(:"may_#{event}?") = render 'components/btn_base', path: public_send(:"site_instance_moderation_#{event}_path", instance_moderation_id: instance_moderation), text: t(".text_#{event}"), - class: 'btn btn-secondary', - disabled: !instance_moderation.public_send(:"may_#{event}?"), + class: ('btn-secondary' if possible), + disabled: !possible, data: local_data[event] diff --git a/app/views/components/_profiles_btn_box.haml b/app/views/components/_profiles_btn_box.haml index 488373b9..9414c178 100644 --- a/app/views/components/_profiles_btn_box.haml +++ b/app/views/components/_profiles_btn_box.haml @@ -2,9 +2,10 @@ .d-flex.flex-row - local_data = { report: { confirm: t('.confirm_report') } } - ActorModeration.events.each do |actor_event| + - possible = !actor_moderation.public_send(:"may_#{actor_event}?") = render 'components/btn_base', text: t(".text_#{actor_event}"), path: public_send(:"site_actor_moderation_#{actor_event}_path", actor_moderation_id: actor_moderation), - class: 'btn-secondary', - disabled: !actor_moderation.public_send(:"may_#{actor_event}?"), + class: ('btn-secondary' if possible), + disabled: !possible, data: local_data[actor_event] From 8dae40cb0ebef8c9851b03467962d2bb6bffb724 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 20 Mar 2024 17:53:00 -0300 Subject: [PATCH 5/5] fix: confirmar al rechazar #15600 --- app/views/components/_comments_btn_box.haml | 2 +- config/locales/en.yml | 1 + config/locales/es.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/components/_comments_btn_box.haml b/app/views/components/_comments_btn_box.haml index ffc773a7..19ea169c 100644 --- a/app/views/components/_comments_btn_box.haml +++ b/app/views/components/_comments_btn_box.haml @@ -1,6 +1,6 @@ -# Componente Botonera de Comentarios -- local_data = { report: { confirm: t('.confirm_report') } } +- local_data = { reject: { confirm: t('.confirm_reject') }, report: { confirm: t('.confirm_report') } } .d-flex.flex-row - ActivityPub.events.each do |event| diff --git a/config/locales/en.yml b/config/locales/en.yml index 8059b6db..c88f7b26 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -107,6 +107,7 @@ en: text_reply: Reply text_report: Report confirm_report: "Send report to the remote instance? This action will also reject the comment." + confirm_reject: "Reject this comment? Please notice we can't undo this action at this moment." instances_btn_box: text_pause: Check case by case text_allow: Allow everything diff --git a/config/locales/es.yml b/config/locales/es.yml index 06b933bc..695b4e60 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -106,6 +106,7 @@ es: text_reject: Rechazar text_report: Reportar confirm_report: "¿Enviar el reporte a la instancia remota? Esta acción también rechazará el comentario." + confirm_reject: "¿Rechazar este comentario? Tené en cuenta que por el momento no es posible deshacer esta acción." instances_btn_box: text_pause: Moderar caso por caso text_allow: Permitir todo