From f9d02cc63eeb38d2b4e8c27e69521a463720eec4 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 28 Feb 2024 16:32:03 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20recordar=20el=20filtro=20que=20est?= =?UTF-8?q?=C3=A1bamos=20usando?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instance_moderations_controller.rb | 21 +++++++++---------- .../moderation_queue_controller.rb | 2 ++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/controllers/instance_moderations_controller.rb b/app/controllers/instance_moderations_controller.rb index 67a6be1d..d25e1450 100644 --- a/app/controllers/instance_moderations_controller.rb +++ b/app/controllers/instance_moderations_controller.rb @@ -3,23 +3,18 @@ # Actualiza la relaciĆ³n entre un sitio y una instancia class InstanceModerationsController < ApplicationController before_action :authorize_policy, except: %i[action_on_several] + around_action :redirect_to_moderation_queue! def pause - instance_moderation.pause! - - redirect_to site_moderation_queue_path + instance_moderation.pause! if instance_moderation.may_pause? end def allow - instance_moderation.allow! - - redirect_to site_moderation_queue_path + instance_moderation.allow! if instance_moderation.may_allow? end def block - instance_moderation.block! - - redirect_to site_moderation_queue_path + instance_moderation.block! if instance_moderation.may_block? end def action_on_several @@ -39,12 +34,16 @@ class InstanceModerationsController < ApplicationController instance_moderation.public_send(method) end end - - redirect_to site_moderation_queue_path end private + def redirect_to_moderation_queue!(&action) + redirect_back fallback_location: site_moderation_queue_path, state: session[:moderation_queue_filtered_by_state] + + yield + end + # @return [InstanceModeration] def instance_moderation @instance_moderation ||= site.instance_moderations.find(params[:instance_moderation_id]) diff --git a/app/controllers/moderation_queue_controller.rb b/app/controllers/moderation_queue_controller.rb index 8c030460..fd7d2acb 100644 --- a/app/controllers/moderation_queue_controller.rb +++ b/app/controllers/moderation_queue_controller.rb @@ -6,6 +6,8 @@ class ModerationQueueController < ApplicationController def index dummy_data + session[:moderation_queue_filtered_by_state] = params[:state] + # @todo cambiar el estado por query @activity_pubs = site.activity_pubs @instance_moderations = rubanok_process(site.instance_moderations, with: InstanceModerationProcessor)