5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 23:56:22 +00:00

feat: poder cambiar el estado a varies actores

This commit is contained in:
f 2024-03-01 16:11:33 -03:00
parent 3fa19ee8b0
commit f8b4586633
No known key found for this signature in database
7 changed files with 43 additions and 23 deletions

View file

@ -20,6 +20,24 @@ class ActorModerationsController < ApplicationController
@remote_profile = actor_moderation.actor.content @remote_profile = actor_moderation.actor.content
end end
def action_on_several
actor_moderations = site.actor_moderations.where(id: params[:actor_moderation])
authorize actor_moderations
action = params[:actor_moderation_action].to_sym
method = :"#{action}!"
may = :"may_#{action}?"
return unless ActorModeration.events.include? action
ActorModeration.transaction do
actor_moderations.find_each do |actor_moderation|
actor_moderation.public_send(method) if actor_moderation.public_send(may)
end
end
end
private private
def actor_moderation def actor_moderation

View file

@ -1,4 +1,2 @@
= render 'components/dropdown_item', text: t('.submenu_pause'), path: '/' - ActorModeration.events.each do |actor_event|
= render 'components/dropdown_item', text: t('.submenu_accept'), path: '/' = render 'components/dropdown_button', text: t(".submenu_#{actor_event}"), name: 'actor_moderation_action', value: actor_event
= render 'components/dropdown_item', text: t('.submenu_reject'), path: '/'
= render 'components/dropdown_item', text: t('.submenu_block'), path: '/'

View file

@ -1,6 +1,6 @@
.row.no-gutters.pt-2 .row.no-gutters.pt-2
.col-1 .col-1
= render 'components/checkbox', id: profile['id'], name: 'actor[]', value: profile['id'], data: { target: 'select-all.input' } = render 'components/checkbox', id: actor_moderation.id, name: 'actor_moderation[]', value: actor_moderation.id, data: { target: 'select-all.input' }
.col-11 .col-11
%h4 %h4
= link_to sanitize(profile['name']), site_actor_moderation_path(id: actor_moderation) = link_to sanitize(profile['name']), site_actor_moderation_path(id: actor_moderation)

View file

@ -1,4 +1,5 @@
.row.no-gutters.pt-2{ data: { controller: 'select-all' } } %form{ action: site_actor_moderations_action_on_several_path, method: :post }
.row.no-gutters.pt-2{ data: { controller: 'select-all' } }
.col-1.d-flex.align-items-center .col-1.d-flex.align-items-center
= render 'components/select_all', id: 'actors' = render 'components/select_all', id: 'actors'
.col-11 .col-11
@ -8,5 +9,6 @@
- if actor_moderations.count.zero? - if actor_moderations.count.zero?
%h4= t('moderation_queue.nothing') %h4= t('moderation_queue.nothing')
- actor_moderations.find_each do |actor_moderation| - actor_moderations.find_each do |actor_moderation|
- cache [actor_moderation, actor_moderation.actor] do
%hr %hr
= render 'account', actor_moderation: actor_moderation, profile: actor_moderation.actor.content = render 'account', actor_moderation: actor_moderation, profile: actor_moderation.actor.content

View file

@ -81,9 +81,9 @@ en:
text_checked: With selected text_checked: With selected
profiles_checked_submenu: profiles_checked_submenu:
submenu_pause: Pause submenu_pause: Pause
submenu_accept: Accept submenu_allow: Allow
submenu_reject: Reject
submenu_block: Block submenu_block: Block
submenu_report: Report
profiles_show_submenu: profiles_show_submenu:
submenu_paused: "Paused (%{count})" submenu_paused: "Paused (%{count})"
submenu_allowed: "Allowed (%{count})" submenu_allowed: "Allowed (%{count})"

View file

@ -80,10 +80,10 @@ es:
text_show: Ver text_show: Ver
text_checked: Con los marcados text_checked: Con los marcados
profiles_checked_submenu: profiles_checked_submenu:
submenu_pause: Pausado submenu_pause: Pausar
submenu_accept: Aceptado submenu_allow: Aceptar
submenu_reject: Rechazado submenu_block: Bloquear
submenu_block: Bloqueado submenu_report: Reportar
profiles_show_submenu: profiles_show_submenu:
submenu_paused: "Pausadas (%{count})" submenu_paused: "Pausadas (%{count})"
submenu_allowed: "Permitidas (%{count})" submenu_allowed: "Permitidas (%{count})"

View file

@ -80,6 +80,8 @@ Rails.application.routes.draw do
end end
end end
patch :actor_moderations_action_on_several, to: 'actor_moderations#action_on_several'
# Gestionar artículos según idioma # Gestionar artículos según idioma
nested do nested do
scope '/(:locale)', constraint: /[a-z]{2}(-[A-Z]{2})?/ do scope '/(:locale)', constraint: /[a-z]{2}(-[A-Z]{2})?/ do