2024-02-26 15:27:56 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Solo les usuaries pueden moderar instancias
|
|
|
|
InstanceModerationPolicy = Struct.new(:usuarie, :instance_moderation) do
|
2024-03-04 17:47:20 +00:00
|
|
|
InstanceModeration.events.each do |event|
|
|
|
|
define_method(:"#{event}?") do
|
|
|
|
instance_moderation.site.usuarie? usuarie
|
|
|
|
end
|
2024-02-26 15:27:56 +00:00
|
|
|
end
|
2024-02-26 20:37:34 +00:00
|
|
|
|
|
|
|
# En este paso tenemos varias instancias por moderar pero todas son
|
|
|
|
# del mismo sitio.
|
|
|
|
def action_on_several?
|
2024-03-22 14:57:22 +00:00
|
|
|
instance_moderation.first.presence && instance_moderation.first.site.usuarie? usuarie
|
2024-02-26 20:37:34 +00:00
|
|
|
end
|
2024-02-26 15:27:56 +00:00
|
|
|
end
|