5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 18:26:21 +00:00

feat: filtrar por estado del comentario

This commit is contained in:
f 2024-03-04 13:59:01 -03:00
parent 5fabe9cd83
commit a2204779af
No known key found for this signature in database
10 changed files with 32 additions and 16 deletions

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
module ModerationQueueHelper
def filter_states(**args)
params.permit(:state, :actor_state, :activity_pub_state).merge(**args)
end
end

View file

@ -12,6 +12,7 @@ class ActivityPub < ApplicationRecord
include AasmEventsConcern
IGNORED_EVENTS = %i[remove]
IGNORED_STATES = %i[removed]
belongs_to :instance
belongs_to :site

View file

@ -6,6 +6,7 @@ class ActorModeration < ApplicationRecord
include AasmEventsConcern
IGNORED_EVENTS = []
IGNORED_STATES = []
belongs_to :site
belongs_to :remote_flag, class_name: 'ActivityPub::RemoteFlag'

View file

@ -10,5 +10,12 @@ module AasmEventsConcern
def self.events
aasm.events.map(&:name) - self::IGNORED_EVENTS
end
# Todos los estados de la máquina de estados
#
# @return [Array<Symbol>]
def self.states
aasm.states.map(&:name) - self::IGNORED_STATES
end
end
end

View file

@ -3,4 +3,4 @@
= render 'components/comments_checked_submenu'
= render 'components/dropdown', text: t('.text_show') do
= render 'components/comments_show_submenu'
= render 'components/comments_show_submenu', activity_pubs: activity_pubs

View file

@ -1,4 +1,4 @@
= 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_report'), path: '/'
= render 'components/dropdown_item', text: t('.submenu_reject'), path: '/'
- ActivityPub.states.each do |state|
= render 'components/dropdown_item',
text: t(".submenu_#{state}", count: activity_pubs.unscope(where: :aasm_state).public_send(state).count),
path: site_moderation_queue_path(filter_states(activity_pub_state: state))

View file

@ -1,4 +1,4 @@
- ActorModeration.aasm.states.map(&:name).each do |actor_state|
- ActorModeration.states.each do |actor_state|
= render 'components/dropdown_item',
text: t(".submenu_#{actor_state}", count: actor_moderations.unscope(where: :aasm_state).public_send(actor_state).count),
path: site_moderation_queue_path(params.permit(:state, :actor_state).merge(actor_state: actor_state))
path: site_moderation_queue_path(filter_states(actor_state: actor_state))

View file

@ -4,7 +4,7 @@
= render 'components/select_all', id: 'select-all-comments'
.col-md-9
-# Filtros
= render 'components/comments_filters'
= render 'components/comments_filters', activity_pubs: moderation_queue
- if moderation_queue.count.zero?
%h4= t('moderation_queue.nothing')

View file

@ -72,10 +72,10 @@ en:
submenu_accept: Accept
submenu_reject: Reject
comments_show_submenu:
submenu_pause: Pause
submenu_accept: Accept
submenu_report: Report
submenu_reject: Reject
submenu_paused: "Paused (%{count})"
submenu_approved: "Approved (%{count})"
submenu_rejected: "Rejected (%{count})"
submenu_reported: "Reported (%{count})"
profiles_filters:
text_show: Show
text_checked: With selected

View file

@ -72,10 +72,10 @@ es:
submenu_accept: Aceptado
submenu_reject: Rechazado
comments_show_submenu:
submenu_pause: Pausado
submenu_accept: Aceptado
submenu_report: Reportado
submenu_reject: Rechazado
submenu_paused: "Pausados (%{count})"
submenu_approved: "Aprobados (%{count})"
submenu_rejected: "Rechazados (%{count})"
submenu_reported: "Reportados (%{count})"
profiles_filters:
text_show: Ver
text_checked: Con los marcados