From 567f0a10fb9f8427157992352be9ebe8dfd636f5 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 1 Mar 2024 16:12:34 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20no=20fallar=20si=20no=20se=20puede=20hac?= =?UTF-8?q?er=20la=20acci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/instance_moderations_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/instance_moderations_controller.rb b/app/controllers/instance_moderations_controller.rb index d25e1450..dc9e1dfa 100644 --- a/app/controllers/instance_moderations_controller.rb +++ b/app/controllers/instance_moderations_controller.rb @@ -24,14 +24,14 @@ class InstanceModerationsController < ApplicationController action = params[:instance_moderation_action].to_sym method = :"#{action}!" + may = :"may_#{action}?" + events = instance_moderation.aasm.events.map(&:name) + + return unless events.include? action InstanceModeration.transaction do instance_moderations.find_each do |instance_moderation| - events = instance_moderation.aasm.events.map(&:name) - - next unless events.include? action - - instance_moderation.public_send(method) + instance_moderation.public_send(method) if instance_moderation.public_send(may) end end end