mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 04:16:21 +00:00
fix: no fallar si no se puede hacer la acción
This commit is contained in:
parent
f8b4586633
commit
567f0a10fb
1 changed files with 5 additions and 5 deletions
|
@ -24,14 +24,14 @@ class InstanceModerationsController < ApplicationController
|
||||||
|
|
||||||
action = params[:instance_moderation_action].to_sym
|
action = params[:instance_moderation_action].to_sym
|
||||||
method = :"#{action}!"
|
method = :"#{action}!"
|
||||||
|
may = :"may_#{action}?"
|
||||||
|
events = instance_moderation.aasm.events.map(&:name)
|
||||||
|
|
||||||
|
return unless events.include? action
|
||||||
|
|
||||||
InstanceModeration.transaction do
|
InstanceModeration.transaction do
|
||||||
instance_moderations.find_each do |instance_moderation|
|
instance_moderations.find_each do |instance_moderation|
|
||||||
events = instance_moderation.aasm.events.map(&:name)
|
instance_moderation.public_send(method) if instance_moderation.public_send(may)
|
||||||
|
|
||||||
next unless events.include? action
|
|
||||||
|
|
||||||
instance_moderation.public_send(method)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue