mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 12:36:21 +00:00
fix: namespace
This commit is contained in:
parent
567f0a10fb
commit
163f3fa737
1 changed files with 11 additions and 10 deletions
|
@ -25,7 +25,8 @@ module Api
|
|||
# Devuelve un error si el token no es válido
|
||||
usuarie.present?
|
||||
|
||||
ActivityPub.transaction do
|
||||
::ActivityPub.transaction do
|
||||
|
||||
# Crea todos los registros necesarios y actualiza el estado
|
||||
actor.present?
|
||||
instance.present?
|
||||
|
@ -47,7 +48,7 @@ module Api
|
|||
#
|
||||
# @todo DRY
|
||||
def onapproved
|
||||
ActivityPub.transaction do
|
||||
::ActivityPub.transaction do
|
||||
actor.present?
|
||||
instance.present?
|
||||
object.present?
|
||||
|
@ -63,7 +64,7 @@ module Api
|
|||
#
|
||||
# @todo DRY
|
||||
def onrejected
|
||||
ActivityPub.transaction do
|
||||
::ActivityPub.transaction do
|
||||
actor.present?
|
||||
instance.present?
|
||||
object.present?
|
||||
|
@ -110,7 +111,7 @@ module Api
|
|||
#
|
||||
# @return [ActivityPub::Object]
|
||||
def object
|
||||
@object ||= ActivityPub::Object.find_or_initialize_by(uri: object_uri).tap do |o|
|
||||
@object ||= ::ActivityPub::Object.find_or_initialize_by(uri: object_uri).tap do |o|
|
||||
# XXX: Si el objeto es una actividad, esto siempre va a ser
|
||||
# Generic
|
||||
o.type ||= 'ActivityPub::Object::Generic'
|
||||
|
@ -120,7 +121,7 @@ module Api
|
|||
|
||||
# XXX: el objeto necesita ser guardado antes de poder
|
||||
# procesarlo
|
||||
ActivityPub::FetchJob.perform_later(site: site, object: o) unless object_embedded?
|
||||
::ActivityPub::FetchJob.perform_later(site: site, object: o) unless object_embedded?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -137,7 +138,7 @@ module Api
|
|||
# @return [ActivityPub::Activity]
|
||||
def activity
|
||||
@activity ||=
|
||||
ActivityPub::Activity
|
||||
::ActivityPub::Activity
|
||||
.type_from(original_activity)
|
||||
.find_or_initialize_by(uri: original_activity[:id], activity_pub: activity_pub, actor: actor).tap do |a|
|
||||
a.content = original_activity.dup
|
||||
|
@ -151,20 +152,20 @@ module Api
|
|||
#
|
||||
# @return [Actor]
|
||||
def actor
|
||||
@actor ||= ActivityPub::Actor.find_or_initialize_by(uri: original_activity[:actor]).tap do |a|
|
||||
@actor ||= ::ActivityPub::Actor.find_or_initialize_by(uri: original_activity[:actor]).tap do |a|
|
||||
unless a.instance
|
||||
a.instance = ActivityPub::Instance.find_or_create_by(hostname: URI.parse(a.uri).hostname)
|
||||
a.instance = ::ActivityPub::Instance.find_or_create_by(hostname: URI.parse(a.uri).hostname)
|
||||
|
||||
site.instance_moderations.find_or_create_by(instance: a.instance)
|
||||
|
||||
ActivityPub::InstanceFetchJob.perform_later(site: site, instance: a.instance)
|
||||
::ActivityPub::InstanceFetchJob.perform_later(site: site, instance: a.instance)
|
||||
end
|
||||
|
||||
a.save!
|
||||
|
||||
site.actor_moderations.find_or_create_by(actor: a)
|
||||
|
||||
ActivityPub::ActorFetchJob.perform_later(site: site, actor: a)
|
||||
::ActivityPub::ActorFetchJob.perform_later(site: site, actor: a)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue