mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 23:16:22 +00:00
feat: filtrar por estado del comentario
This commit is contained in:
parent
5fabe9cd83
commit
a2204779af
10 changed files with 32 additions and 16 deletions
7
app/helpers/moderation_queue_helper.rb
Normal file
7
app/helpers/moderation_queue_helper.rb
Normal 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
|
|
@ -12,6 +12,7 @@ class ActivityPub < ApplicationRecord
|
|||
include AasmEventsConcern
|
||||
|
||||
IGNORED_EVENTS = %i[remove]
|
||||
IGNORED_STATES = %i[removed]
|
||||
|
||||
belongs_to :instance
|
||||
belongs_to :site
|
||||
|
|
|
@ -6,6 +6,7 @@ class ActorModeration < ApplicationRecord
|
|||
include AasmEventsConcern
|
||||
|
||||
IGNORED_EVENTS = []
|
||||
IGNORED_STATES = []
|
||||
|
||||
belongs_to :site
|
||||
belongs_to :remote_flag, class_name: 'ActivityPub::RemoteFlag'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue