mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 04:06:21 +00:00
fix: raise
This commit is contained in:
parent
44ef583a23
commit
19d998086c
4 changed files with 10 additions and 12 deletions
|
@ -68,8 +68,7 @@ class ActivityPub < ApplicationRecord
|
|||
transitions from: %i[paused], to: :approved
|
||||
|
||||
before do
|
||||
raise AASM::InvalidTransition unless
|
||||
site.social_inbox.inbox.accept(id: object.uri).ok?
|
||||
raise unless site.social_inbox.inbox.accept(id: object.uri).ok?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -78,8 +77,7 @@ class ActivityPub < ApplicationRecord
|
|||
transitions from: %i[paused approved], to: :rejected
|
||||
|
||||
before do
|
||||
raise AASM::InvalidTransition unless
|
||||
site.social_inbox.inbox.reject(id: object.uri).ok?
|
||||
raise unless site.social_inbox.inbox.reject(id: object.uri).ok?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -65,21 +65,21 @@ class ActorModeration < ApplicationRecord
|
|||
end
|
||||
|
||||
def pause_remotely!
|
||||
raise AASM::InvalidTransition unless
|
||||
raise unless
|
||||
actor.mention &&
|
||||
site.social_inbox.allowlist.delete(list: [actor.mention]).ok? &&
|
||||
site.social_inbox.blocklist.delete(list: [actor.mention]).ok?
|
||||
end
|
||||
|
||||
def allow_remotely!
|
||||
raise AASM::InvalidTransition unless
|
||||
raise unless
|
||||
actor.mention &&
|
||||
site.social_inbox.allowlist.post(list: [actor.mention]).ok? &&
|
||||
site.social_inbox.blocklist.delete(list: [actor.mention]).ok?
|
||||
end
|
||||
|
||||
def block_remotely!
|
||||
raise AASM::InvalidTransition unless
|
||||
raise unless
|
||||
actor.mention &&
|
||||
site.social_inbox.allowlist.delete(list: [actor.mention]).ok? &&
|
||||
site.social_inbox.blocklist.post(list: [actor.mention]).ok?
|
||||
|
|
|
@ -89,14 +89,14 @@ class FediblockState < ApplicationRecord
|
|||
|
||||
# Al deshabilitar, las instancias pasan a ser analizadas caso por caso
|
||||
def disable_remotely!
|
||||
raise AASM::InvalidTransition unless
|
||||
raise unless
|
||||
site.social_inbox.blocklist.delete(list: list_names).ok? &&
|
||||
site.social_inbox.allowlist.delete(list: list_names).ok?
|
||||
end
|
||||
|
||||
# Al habilitar, se bloquean todas las instancias de la lista
|
||||
def enable_remotely!
|
||||
raise AASM::InvalidTransition unless
|
||||
raise unless
|
||||
site.social_inbox.blocklist.post(list: list_names).ok? &&
|
||||
site.social_inbox.allowlist.delete(list: list_names).ok?
|
||||
end
|
||||
|
|
|
@ -60,7 +60,7 @@ class InstanceModeration < ApplicationRecord
|
|||
#
|
||||
# @return [Boolean]
|
||||
def pause_remotely!
|
||||
raise AASM::InvalidTransition unless
|
||||
raise unless
|
||||
site.social_inbox.blocklist.delete(list: [instance.list_name]).ok? &&
|
||||
site.social_inbox.allowlist.delete(list: [instance.list_name]).ok?
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ class InstanceModeration < ApplicationRecord
|
|||
#
|
||||
# @return [Boolean]
|
||||
def block_remotely!
|
||||
raise AASM::InvalidTransition unless
|
||||
raise unless
|
||||
site.social_inbox.allowlist.delete(list: [instance.list_name]).ok? &&
|
||||
site.social_inbox.blocklist.post(list: [instance.list_name]).ok?
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ class InstanceModeration < ApplicationRecord
|
|||
#
|
||||
# @return [Boolean]
|
||||
def allow_remotely!
|
||||
raise AASM::InvalidTransition unless
|
||||
raise unless
|
||||
site.social_inbox.blocklist.delete(list: [instance.list_name]).ok? &&
|
||||
site.social_inbox.allowlist.post(list: [instance.list_name]).ok?
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue