5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 05:16: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
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
def actor_moderation

View file

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

View file

@ -1,6 +1,6 @@
.row.no-gutters.pt-2
.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
%h4
= link_to sanitize(profile['name']), site_actor_moderation_path(id: actor_moderation)

View file

@ -1,3 +1,4 @@
%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
= render 'components/select_all', id: 'actors'
@ -8,5 +9,6 @@
- if actor_moderations.count.zero?
%h4= t('moderation_queue.nothing')
- actor_moderations.find_each do |actor_moderation|
- cache [actor_moderation, actor_moderation.actor] do
%hr
= render 'account', actor_moderation: actor_moderation, profile: actor_moderation.actor.content

View file

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

View file

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

View file

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