mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 20:46: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
|
end
|
||||||
|
|
||||||
def action_on_several
|
def action_on_several
|
||||||
|
redirect_to_moderation_queue!
|
||||||
|
|
||||||
activity_pubs = site.activity_pubs.where(id: params[:activity_pub])
|
activity_pubs = site.activity_pubs.where(id: params[:activity_pub])
|
||||||
|
|
||||||
|
return if activity_pubs.count.zero?
|
||||||
|
|
||||||
authorize activity_pubs
|
authorize activity_pubs
|
||||||
|
|
||||||
action = params[:activity_pub_action].to_sym
|
action = params[:activity_pub_action].to_sym
|
||||||
method = :"#{action}_all!"
|
method = :"#{action}_all!"
|
||||||
may = :"may_#{action}?"
|
may = :"may_#{action}?"
|
||||||
|
|
||||||
redirect_to_moderation_queue!
|
|
||||||
|
|
||||||
return unless ActivityPub.events.include? action
|
return unless ActivityPub.events.include? action
|
||||||
|
|
||||||
# Crear una sola remote flag por autore
|
# Crear una sola remote flag por autore
|
||||||
|
|
|
@ -48,16 +48,18 @@ class ActorModerationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def action_on_several
|
def action_on_several
|
||||||
|
redirect_to_moderation_queue!
|
||||||
|
|
||||||
actor_moderations = site.actor_moderations.where(id: params[:actor_moderation])
|
actor_moderations = site.actor_moderations.where(id: params[:actor_moderation])
|
||||||
|
|
||||||
|
return if actor_moderations.count.zero?
|
||||||
|
|
||||||
authorize actor_moderations
|
authorize actor_moderations
|
||||||
|
|
||||||
action = params[:actor_moderation_action].to_sym
|
action = params[:actor_moderation_action].to_sym
|
||||||
method = :"#{action}_all!"
|
method = :"#{action}_all!"
|
||||||
may = :"may_#{action}?"
|
may = :"may_#{action}?"
|
||||||
|
|
||||||
redirect_to_moderation_queue!
|
|
||||||
|
|
||||||
return unless ActorModeration.events.include? action
|
return unless ActorModeration.events.include? action
|
||||||
|
|
||||||
ActorModeration.transaction do
|
ActorModeration.transaction do
|
||||||
|
|
|
@ -22,15 +22,17 @@ class InstanceModerationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def action_on_several
|
def action_on_several
|
||||||
|
redirect_to_moderation_queue!
|
||||||
|
|
||||||
instance_moderations = site.instance_moderations.where(id: params[:instance_moderation])
|
instance_moderations = site.instance_moderations.where(id: params[:instance_moderation])
|
||||||
|
|
||||||
|
return if instance_moderations.count.zero?
|
||||||
|
|
||||||
authorize instance_moderations
|
authorize instance_moderations
|
||||||
|
|
||||||
action = params[:instance_moderation_action].to_sym
|
action = params[:instance_moderation_action].to_sym
|
||||||
method = :"#{action}_all!"
|
method = :"#{action}_all!"
|
||||||
|
|
||||||
redirect_to_moderation_queue!
|
|
||||||
|
|
||||||
return unless InstanceModeration.events.include? action
|
return unless InstanceModeration.events.include? action
|
||||||
|
|
||||||
InstanceModeration.transaction do
|
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
|
# En este paso tenemos varias instancias por moderar pero todas son
|
||||||
# del mismo sitio.
|
# del mismo sitio.
|
||||||
def action_on_several?
|
def action_on_several?
|
||||||
instance_moderation.first.site.usuarie? usuarie
|
instance_moderation.first.presence && instance_moderation.first.site.usuarie? usuarie
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue