mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 13:56: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
|
# Devuelve un error si el token no es válido
|
||||||
usuarie.present?
|
usuarie.present?
|
||||||
|
|
||||||
ActivityPub.transaction do
|
::ActivityPub.transaction do
|
||||||
|
|
||||||
# Crea todos los registros necesarios y actualiza el estado
|
# Crea todos los registros necesarios y actualiza el estado
|
||||||
actor.present?
|
actor.present?
|
||||||
instance.present?
|
instance.present?
|
||||||
|
@ -47,7 +48,7 @@ module Api
|
||||||
#
|
#
|
||||||
# @todo DRY
|
# @todo DRY
|
||||||
def onapproved
|
def onapproved
|
||||||
ActivityPub.transaction do
|
::ActivityPub.transaction do
|
||||||
actor.present?
|
actor.present?
|
||||||
instance.present?
|
instance.present?
|
||||||
object.present?
|
object.present?
|
||||||
|
@ -63,7 +64,7 @@ module Api
|
||||||
#
|
#
|
||||||
# @todo DRY
|
# @todo DRY
|
||||||
def onrejected
|
def onrejected
|
||||||
ActivityPub.transaction do
|
::ActivityPub.transaction do
|
||||||
actor.present?
|
actor.present?
|
||||||
instance.present?
|
instance.present?
|
||||||
object.present?
|
object.present?
|
||||||
|
@ -110,7 +111,7 @@ module Api
|
||||||
#
|
#
|
||||||
# @return [ActivityPub::Object]
|
# @return [ActivityPub::Object]
|
||||||
def 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
|
# XXX: Si el objeto es una actividad, esto siempre va a ser
|
||||||
# Generic
|
# Generic
|
||||||
o.type ||= 'ActivityPub::Object::Generic'
|
o.type ||= 'ActivityPub::Object::Generic'
|
||||||
|
@ -120,7 +121,7 @@ module Api
|
||||||
|
|
||||||
# XXX: el objeto necesita ser guardado antes de poder
|
# XXX: el objeto necesita ser guardado antes de poder
|
||||||
# procesarlo
|
# 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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ module Api
|
||||||
# @return [ActivityPub::Activity]
|
# @return [ActivityPub::Activity]
|
||||||
def activity
|
def activity
|
||||||
@activity ||=
|
@activity ||=
|
||||||
ActivityPub::Activity
|
::ActivityPub::Activity
|
||||||
.type_from(original_activity)
|
.type_from(original_activity)
|
||||||
.find_or_initialize_by(uri: original_activity[:id], activity_pub: activity_pub, actor: actor).tap do |a|
|
.find_or_initialize_by(uri: original_activity[:id], activity_pub: activity_pub, actor: actor).tap do |a|
|
||||||
a.content = original_activity.dup
|
a.content = original_activity.dup
|
||||||
|
@ -151,20 +152,20 @@ module Api
|
||||||
#
|
#
|
||||||
# @return [Actor]
|
# @return [Actor]
|
||||||
def 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
|
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)
|
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
|
end
|
||||||
|
|
||||||
a.save!
|
a.save!
|
||||||
|
|
||||||
site.actor_moderations.find_or_create_by(actor: a)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue