From 3ba23a8b8c49ae25accd7bbcfaef99f6779d8a05 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 29 Feb 2024 15:54:53 -0300 Subject: [PATCH] feat: poder ir al perfil desde la lista --- .../actor_moderations_controller.rb | 7 ++++- .../moderation_queue_controller.rb | 5 ---- app/views/actor_moderations/show.haml | 8 +++-- app/views/components/_actor.haml | 21 ++++++++++++++ app/views/components/_profiles_btn_box.haml | 15 +++++----- app/views/moderation_queue/_account.haml | 2 +- .../moderation_queue/_remote_profile.haml | 29 ------------------- .../moderation_queue/remote_profile.haml | 4 --- config/locales/en.yml | 17 ++++++----- config/locales/es.yml | 17 ++++++----- config/routes.rb | 3 +- 11 files changed, 61 insertions(+), 67 deletions(-) create mode 100644 app/views/components/_actor.haml delete mode 100644 app/views/moderation_queue/_remote_profile.haml delete mode 100644 app/views/moderation_queue/remote_profile.haml diff --git a/app/controllers/actor_moderations_controller.rb b/app/controllers/actor_moderations_controller.rb index 543ca74d..f4637d70 100644 --- a/app/controllers/actor_moderations_controller.rb +++ b/app/controllers/actor_moderations_controller.rb @@ -12,9 +12,14 @@ class ActorModerationsController < ApplicationController end end + # Ver el perfil remoto + def show + @remote_profile = actor_moderation.actor.content + end + private def actor_moderation - @actor_moderation ||= site.actor_moderations.find(params[:actor_moderation_id]) + @actor_moderation ||= site.actor_moderations.find(params[:actor_moderation_id] || params[:id]) end end diff --git a/app/controllers/moderation_queue_controller.rb b/app/controllers/moderation_queue_controller.rb index df36dfbe..95639b35 100644 --- a/app/controllers/moderation_queue_controller.rb +++ b/app/controllers/moderation_queue_controller.rb @@ -14,11 +14,6 @@ class ModerationQueueController < ApplicationController @actor_moderations = rubanok_process(site.actor_moderations, with: ActorModerationProcessor) end - # Perfil remoto de usuarie - def remote_profile - dummy_data - end - # todon.nl está usando /api/v2/instance # mauve.moe usa /api/v1/instance def instances diff --git a/app/views/actor_moderations/show.haml b/app/views/actor_moderations/show.haml index ba0fc257..7b62f672 100644 --- a/app/views/actor_moderations/show.haml +++ b/app/views/actor_moderations/show.haml @@ -1,4 +1,8 @@ .row.justify-content-center - .col-md-8 + .col-12.col-md-8 %h1= t('.profile') - = render 'moderation_queue/remote_profile', remote_profile: @remote_profile + = render 'components/actor', remote_profile: @remote_profile + .col-12.col-md-8 + = render 'components/profiles_btn_box', actor_moderation: @actor_moderation + -# + = render 'moderation_queue/comments', moderation_queue: @moderation_queue diff --git a/app/views/components/_actor.haml b/app/views/components/_actor.haml new file mode 100644 index 00000000..f5d6efae --- /dev/null +++ b/app/views/components/_actor.haml @@ -0,0 +1,21 @@ +-# Componente Remote_Profile + +.py-2 + %dl + %dt= t('.profile_name') + %dd= sanitize remote_profile['name'] + + %dt= t('.preferred_name') + %dd= sanitize remote_profile['preferredUsername'] + + %dt= t('.profile_id') + %dd + = link_to sanitize(remote_profile['id']) + + - if remote_profile['published'].present? + %dt= t('.profile_published') + %dd + = render 'layouts/time', time: sanitize(remote_profile['published']) + %dt= t('.profile_summary') + %dd + = sanitize remote_profile['summary'] diff --git a/app/views/components/_profiles_btn_box.haml b/app/views/components/_profiles_btn_box.haml index bc1fd7e4..bd994f84 100644 --- a/app/views/components/_profiles_btn_box.haml +++ b/app/views/components/_profiles_btn_box.haml @@ -1,9 +1,10 @@ -# Componente Botonera de Moderación de Cuentas (Remote_profile) -- btn_class = 'btn-secondary' -- ActorModeration.events.each do |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_class, - disabled: !actor_moderation.public_send(:"may_#{actor_event}?") +.d-flex.flex-row + - btn_class = 'btn-secondary' + - ActorModeration.events.each do |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_class, + disabled: !actor_moderation.public_send(:"may_#{actor_event}?") diff --git a/app/views/moderation_queue/_account.haml b/app/views/moderation_queue/_account.haml index 24fbb270..cdcc0ad4 100644 --- a/app/views/moderation_queue/_account.haml +++ b/app/views/moderation_queue/_account.haml @@ -3,7 +3,7 @@ = render 'components/checkbox', id: profile['id'], name: 'actor[]', value: profile['id'], data: { target: 'select-all.input' } .col-11 %h4 - %a{href: profile['id']}= sanitize profile['name'] + = link_to sanitize(profile['name']), site_actor_moderation_path(id: actor_moderation) .mb-3 = sanitize profile['summary'].html_safe diff --git a/app/views/moderation_queue/_remote_profile.haml b/app/views/moderation_queue/_remote_profile.haml deleted file mode 100644 index 92cf8e96..00000000 --- a/app/views/moderation_queue/_remote_profile.haml +++ /dev/null @@ -1,29 +0,0 @@ --# Componente Remote_Profile - -.flex.py-2.mx-2 - %dl - %dt= t('.profile_name') - %dd= remote_profile['name'] - - %dt= t('.preferred_name') - %dd= remote_profile['preferredUsername'] - - %dt= t('.profile_id') - %dd - %a{ href: 'https://mastodon.mauve.moe/users/mauve' }= remote_profile['id'] - - %dt= t('.profile_published') - %dd - = render 'layouts/time', time: remote_profile['published'] - %dt= t('.profile_summary') - %dd - %p= remote_profile['summary'].html_safe - - = render 'moderation_queue/comments', moderation_queue: @moderation_queue - -%dl.mt-5 - %dt= t('.profile_name') - %dd= remote_profile['name'] - --# Botones de Moderación -= render 'components/profiles_btn_box' diff --git a/app/views/moderation_queue/remote_profile.haml b/app/views/moderation_queue/remote_profile.haml deleted file mode 100644 index ba0fc257..00000000 --- a/app/views/moderation_queue/remote_profile.haml +++ /dev/null @@ -1,4 +0,0 @@ -.row.justify-content-center - .col-md-8 - %h1= t('.profile') - = render 'moderation_queue/remote_profile', remote_profile: @remote_profile diff --git a/config/locales/en.yml b/config/locales/en.yml index 3c8e8851..62e9a1a7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -106,6 +106,15 @@ en: text_allow: Always approve text_block: Block text_report: Report + actor_moderations: + show: + user: Username + profile: Profile + profile_name: Profile name + preferred_name: Name in Fediverse + profile_id: ID + profile_published: Published + profile_summary: Summary moderation_queue: everything: 'Select all' nothing: "There's nothing for this filter" @@ -117,14 +126,6 @@ en: comment: source_profile: Source Profile reply_to: Reply to - remote_profile: - user: Username - profile: Profile - profile_name: Profile name - preferred_name: Name in Fediverse - profile_id: ID - profile_published: Published - profile_summary: Summary instances: title: My block lists description: Description diff --git a/config/locales/es.yml b/config/locales/es.yml index d2c30ef6..3dc68d98 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -106,6 +106,15 @@ es: text_allow: Aprobar siempre text_block: Bloquear text_report: Reportar + actor_moderations: + show: + user: Nombre de usuarie + profile: Cuenta de Origen + profile_name: Nombre de la cuenta + preferred_name: Nombre en el Fediverso + profile_id: ID + profile_published: Publicada + profile_summary: Presentación moderation_queue: everything: 'Seleccionar todo' nothing: 'No hay nada para este filtro' @@ -117,14 +126,6 @@ es: comment: source_profile: Cuenta de Origen reply_to: En respuesta a - remote_profile: - user: Nombre de usuario - profile: Cuenta de Origen - profile_name: Nombre de la Cuenta - preferred_name: Nombre en el Fediverso - profile_id: ID - profile_published: Publicada - profile_summary: Presentación instances: title: Mis listas de bloqueo description: Descripción de listas de bloqueo diff --git a/config/routes.rb b/config/routes.rb index f6b412e2..ceffcd26 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -59,7 +59,6 @@ Rails.application.routes.draw do post 'collaborate', to: 'collaborations#accept_collaboration' get 'moderation_queue', to: 'moderation_queue#index' - get 'remote_profile', to: 'moderation_queue#remote_profile' get 'instances', to: 'moderation_queue#instances' resources :instance_moderations, only: [] do @@ -71,7 +70,7 @@ Rails.application.routes.draw do patch :instance_moderations_action_on_several, to: 'instance_moderations#action_on_several' patch :fediblock_states_action_on_several, to: 'fediblock_states#action_on_several' - resources :actor_moderations, only: [] do + resources :actor_moderations, only: %i[show] do ActorModeration.events.each do |actor_event| patch actor_event, to: "actor_moderations##{actor_event}" end