mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 03:16:23 +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
|
include AasmEventsConcern
|
||||||
|
|
||||||
IGNORED_EVENTS = %i[remove]
|
IGNORED_EVENTS = %i[remove]
|
||||||
|
IGNORED_STATES = %i[removed]
|
||||||
|
|
||||||
belongs_to :instance
|
belongs_to :instance
|
||||||
belongs_to :site
|
belongs_to :site
|
||||||
|
|
|
@ -6,6 +6,7 @@ class ActorModeration < ApplicationRecord
|
||||||
include AasmEventsConcern
|
include AasmEventsConcern
|
||||||
|
|
||||||
IGNORED_EVENTS = []
|
IGNORED_EVENTS = []
|
||||||
|
IGNORED_STATES = []
|
||||||
|
|
||||||
belongs_to :site
|
belongs_to :site
|
||||||
belongs_to :remote_flag, class_name: 'ActivityPub::RemoteFlag'
|
belongs_to :remote_flag, class_name: 'ActivityPub::RemoteFlag'
|
||||||
|
|
|
@ -10,5 +10,12 @@ module AasmEventsConcern
|
||||||
def self.events
|
def self.events
|
||||||
aasm.events.map(&:name) - self::IGNORED_EVENTS
|
aasm.events.map(&:name) - self::IGNORED_EVENTS
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
= render 'components/comments_checked_submenu'
|
= render 'components/comments_checked_submenu'
|
||||||
|
|
||||||
= render 'components/dropdown', text: t('.text_show') do
|
= 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: '/'
|
- ActivityPub.states.each do |state|
|
||||||
= render 'components/dropdown_item', text: t('.submenu_accept'), path: '/'
|
= render 'components/dropdown_item',
|
||||||
= render 'components/dropdown_item', text: t('.submenu_report'), path: '/'
|
text: t(".submenu_#{state}", count: activity_pubs.unscope(where: :aasm_state).public_send(state).count),
|
||||||
= render 'components/dropdown_item', text: t('.submenu_reject'), path: '/'
|
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',
|
= render 'components/dropdown_item',
|
||||||
text: t(".submenu_#{actor_state}", count: actor_moderations.unscope(where: :aasm_state).public_send(actor_state).count),
|
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'
|
= render 'components/select_all', id: 'select-all-comments'
|
||||||
.col-md-9
|
.col-md-9
|
||||||
-# Filtros
|
-# Filtros
|
||||||
= render 'components/comments_filters'
|
= render 'components/comments_filters', activity_pubs: moderation_queue
|
||||||
|
|
||||||
- if moderation_queue.count.zero?
|
- if moderation_queue.count.zero?
|
||||||
%h4= t('moderation_queue.nothing')
|
%h4= t('moderation_queue.nothing')
|
||||||
|
|
|
@ -72,10 +72,10 @@ en:
|
||||||
submenu_accept: Accept
|
submenu_accept: Accept
|
||||||
submenu_reject: Reject
|
submenu_reject: Reject
|
||||||
comments_show_submenu:
|
comments_show_submenu:
|
||||||
submenu_pause: Pause
|
submenu_paused: "Paused (%{count})"
|
||||||
submenu_accept: Accept
|
submenu_approved: "Approved (%{count})"
|
||||||
submenu_report: Report
|
submenu_rejected: "Rejected (%{count})"
|
||||||
submenu_reject: Reject
|
submenu_reported: "Reported (%{count})"
|
||||||
profiles_filters:
|
profiles_filters:
|
||||||
text_show: Show
|
text_show: Show
|
||||||
text_checked: With selected
|
text_checked: With selected
|
||||||
|
|
|
@ -72,10 +72,10 @@ es:
|
||||||
submenu_accept: Aceptado
|
submenu_accept: Aceptado
|
||||||
submenu_reject: Rechazado
|
submenu_reject: Rechazado
|
||||||
comments_show_submenu:
|
comments_show_submenu:
|
||||||
submenu_pause: Pausado
|
submenu_paused: "Pausados (%{count})"
|
||||||
submenu_accept: Aceptado
|
submenu_approved: "Aprobados (%{count})"
|
||||||
submenu_report: Reportado
|
submenu_rejected: "Rechazados (%{count})"
|
||||||
submenu_reject: Rechazado
|
submenu_reported: "Reportados (%{count})"
|
||||||
profiles_filters:
|
profiles_filters:
|
||||||
text_show: Ver
|
text_show: Ver
|
||||||
text_checked: Con los marcados
|
text_checked: Con los marcados
|
||||||
|
|
Loading…
Reference in a new issue