5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 07:36:22 +00:00

fix: raise

This commit is contained in:
f 2024-03-06 14:31:32 -03:00
parent 44ef583a23
commit 19d998086c
No known key found for this signature in database
4 changed files with 10 additions and 12 deletions

View file

@ -68,8 +68,7 @@ class ActivityPub < ApplicationRecord
transitions from: %i[paused], to: :approved transitions from: %i[paused], to: :approved
before do before do
raise AASM::InvalidTransition unless raise unless site.social_inbox.inbox.accept(id: object.uri).ok?
site.social_inbox.inbox.accept(id: object.uri).ok?
end end
end end
@ -78,8 +77,7 @@ class ActivityPub < ApplicationRecord
transitions from: %i[paused approved], to: :rejected transitions from: %i[paused approved], to: :rejected
before do before do
raise AASM::InvalidTransition unless raise unless site.social_inbox.inbox.reject(id: object.uri).ok?
site.social_inbox.inbox.reject(id: object.uri).ok?
end end
end end

View file

@ -65,21 +65,21 @@ class ActorModeration < ApplicationRecord
end end
def pause_remotely! def pause_remotely!
raise AASM::InvalidTransition unless raise unless
actor.mention && actor.mention &&
site.social_inbox.allowlist.delete(list: [actor.mention]).ok? && site.social_inbox.allowlist.delete(list: [actor.mention]).ok? &&
site.social_inbox.blocklist.delete(list: [actor.mention]).ok? site.social_inbox.blocklist.delete(list: [actor.mention]).ok?
end end
def allow_remotely! def allow_remotely!
raise AASM::InvalidTransition unless raise unless
actor.mention && actor.mention &&
site.social_inbox.allowlist.post(list: [actor.mention]).ok? && site.social_inbox.allowlist.post(list: [actor.mention]).ok? &&
site.social_inbox.blocklist.delete(list: [actor.mention]).ok? site.social_inbox.blocklist.delete(list: [actor.mention]).ok?
end end
def block_remotely! def block_remotely!
raise AASM::InvalidTransition unless raise unless
actor.mention && actor.mention &&
site.social_inbox.allowlist.delete(list: [actor.mention]).ok? && site.social_inbox.allowlist.delete(list: [actor.mention]).ok? &&
site.social_inbox.blocklist.post(list: [actor.mention]).ok? site.social_inbox.blocklist.post(list: [actor.mention]).ok?

View file

@ -89,14 +89,14 @@ class FediblockState < ApplicationRecord
# Al deshabilitar, las instancias pasan a ser analizadas caso por caso # Al deshabilitar, las instancias pasan a ser analizadas caso por caso
def disable_remotely! def disable_remotely!
raise AASM::InvalidTransition unless raise unless
site.social_inbox.blocklist.delete(list: list_names).ok? && site.social_inbox.blocklist.delete(list: list_names).ok? &&
site.social_inbox.allowlist.delete(list: list_names).ok? site.social_inbox.allowlist.delete(list: list_names).ok?
end end
# Al habilitar, se bloquean todas las instancias de la lista # Al habilitar, se bloquean todas las instancias de la lista
def enable_remotely! def enable_remotely!
raise AASM::InvalidTransition unless raise unless
site.social_inbox.blocklist.post(list: list_names).ok? && site.social_inbox.blocklist.post(list: list_names).ok? &&
site.social_inbox.allowlist.delete(list: list_names).ok? site.social_inbox.allowlist.delete(list: list_names).ok?
end end

View file

@ -60,7 +60,7 @@ class InstanceModeration < ApplicationRecord
# #
# @return [Boolean] # @return [Boolean]
def pause_remotely! def pause_remotely!
raise AASM::InvalidTransition unless raise unless
site.social_inbox.blocklist.delete(list: [instance.list_name]).ok? && site.social_inbox.blocklist.delete(list: [instance.list_name]).ok? &&
site.social_inbox.allowlist.delete(list: [instance.list_name]).ok? site.social_inbox.allowlist.delete(list: [instance.list_name]).ok?
end end
@ -69,7 +69,7 @@ class InstanceModeration < ApplicationRecord
# #
# @return [Boolean] # @return [Boolean]
def block_remotely! def block_remotely!
raise AASM::InvalidTransition unless raise unless
site.social_inbox.allowlist.delete(list: [instance.list_name]).ok? && site.social_inbox.allowlist.delete(list: [instance.list_name]).ok? &&
site.social_inbox.blocklist.post(list: [instance.list_name]).ok? site.social_inbox.blocklist.post(list: [instance.list_name]).ok?
end end
@ -78,7 +78,7 @@ class InstanceModeration < ApplicationRecord
# #
# @return [Boolean] # @return [Boolean]
def allow_remotely! def allow_remotely!
raise AASM::InvalidTransition unless raise unless
site.social_inbox.blocklist.delete(list: [instance.list_name]).ok? && site.social_inbox.blocklist.delete(list: [instance.list_name]).ok? &&
site.social_inbox.allowlist.post(list: [instance.list_name]).ok? site.social_inbox.allowlist.post(list: [instance.list_name]).ok?
end end