mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 15:16:21 +00:00
fix: no fallar si no hay registros sobre los que actuar #15725
This commit is contained in:
parent
4853263374
commit
0561b022de
4 changed files with 13 additions and 7 deletions
|
@ -29,16 +29,18 @@ class ActivityPubsController < ApplicationController
|
|||
end
|
||||
|
||||
def action_on_several
|
||||
redirect_to_moderation_queue!
|
||||
|
||||
activity_pubs = site.activity_pubs.where(id: params[:activity_pub])
|
||||
|
||||
return if activity_pubs.count.zero?
|
||||
|
||||
authorize activity_pubs
|
||||
|
||||
action = params[:activity_pub_action].to_sym
|
||||
method = :"#{action}_all!"
|
||||
may = :"may_#{action}?"
|
||||
|
||||
redirect_to_moderation_queue!
|
||||
|
||||
return unless ActivityPub.events.include? action
|
||||
|
||||
# Crear una sola remote flag por autore
|
||||
|
|
|
@ -48,16 +48,18 @@ class ActorModerationsController < ApplicationController
|
|||
end
|
||||
|
||||
def action_on_several
|
||||
redirect_to_moderation_queue!
|
||||
|
||||
actor_moderations = site.actor_moderations.where(id: params[:actor_moderation])
|
||||
|
||||
return if actor_moderations.count.zero?
|
||||
|
||||
authorize actor_moderations
|
||||
|
||||
action = params[:actor_moderation_action].to_sym
|
||||
method = :"#{action}_all!"
|
||||
may = :"may_#{action}?"
|
||||
|
||||
redirect_to_moderation_queue!
|
||||
|
||||
return unless ActorModeration.events.include? action
|
||||
|
||||
ActorModeration.transaction do
|
||||
|
|
|
@ -22,15 +22,17 @@ class InstanceModerationsController < ApplicationController
|
|||
end
|
||||
|
||||
def action_on_several
|
||||
redirect_to_moderation_queue!
|
||||
|
||||
instance_moderations = site.instance_moderations.where(id: params[:instance_moderation])
|
||||
|
||||
return if instance_moderations.count.zero?
|
||||
|
||||
authorize instance_moderations
|
||||
|
||||
action = params[:instance_moderation_action].to_sym
|
||||
method = :"#{action}_all!"
|
||||
|
||||
redirect_to_moderation_queue!
|
||||
|
||||
return unless InstanceModeration.events.include? action
|
||||
|
||||
InstanceModeration.transaction do
|
||||
|
|
|
@ -11,6 +11,6 @@ InstanceModerationPolicy = Struct.new(:usuarie, :instance_moderation) do
|
|||
# En este paso tenemos varias instancias por moderar pero todas son
|
||||
# del mismo sitio.
|
||||
def action_on_several?
|
||||
instance_moderation.first.site.usuarie? usuarie
|
||||
instance_moderation.first.presence && instance_moderation.first.site.usuarie? usuarie
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue