2024-02-28 22:10:37 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Gestiona la cola de moderación de actores
|
|
|
|
class ActorModerationsController < ApplicationController
|
2024-03-01 18:51:54 +00:00
|
|
|
ActorModeration.events.each do |actor_event|
|
2024-02-28 22:10:37 +00:00
|
|
|
define_method(actor_event) do
|
|
|
|
authorize actor_moderation
|
|
|
|
|
2024-03-01 18:51:54 +00:00
|
|
|
# Crea una RemoteFlag si se envían los parámetros adecuados
|
|
|
|
actor_moderation.update(actor_moderation_params) if actor_event == :report
|
|
|
|
|
2024-02-28 22:10:37 +00:00
|
|
|
actor_moderation.public_send(:"#{actor_event}!") if actor_moderation.public_send(:"may_#{actor_event}?")
|
|
|
|
|
|
|
|
redirect_back fallback_location: site_moderation_queue_path(**(session[:moderation_queue_filters] || {}))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-02-29 18:54:53 +00:00
|
|
|
# Ver el perfil remoto
|
|
|
|
def show
|
|
|
|
@remote_profile = actor_moderation.actor.content
|
|
|
|
end
|
|
|
|
|
2024-02-28 22:10:37 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def actor_moderation
|
2024-02-29 18:54:53 +00:00
|
|
|
@actor_moderation ||= site.actor_moderations.find(params[:actor_moderation_id] || params[:id])
|
2024-02-28 22:10:37 +00:00
|
|
|
end
|
2024-03-01 18:51:54 +00:00
|
|
|
|
|
|
|
def actor_moderation_params
|
|
|
|
params.require(:actor_moderation).permit(remote_flag_attributes: %i[message]).tap do |p|
|
|
|
|
p[:remote_flag_attributes][:site_id] = actor_moderation.site_id
|
|
|
|
p[:remote_flag_attributes][:actor_id] = actor_moderation.actor_id
|
|
|
|
end
|
|
|
|
end
|
2024-02-28 22:10:37 +00:00
|
|
|
end
|