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

fix: bloquear antes de empezar a modificar

closes #15791
This commit is contained in:
f 2024-03-22 13:09:13 -03:00
parent dad5f5f00c
commit 071f20762c
No known key found for this signature in database

View file

@ -64,9 +64,9 @@ class ActivityPub
# @return [ActivityPub::Object]
def object
@object ||= ::ActivityPub::Object.lock.find_or_initialize_by(uri: object_uri).tap do |o|
o.lock! if o.persisted?
o.content = original_object if object_embedded?
o.lock! if o.persisted?
o.save!
# XXX: el objeto necesita ser guardado antes de poder
@ -94,9 +94,9 @@ class ActivityPub
.type_from(original_activity)
.lock
.find_or_initialize_by(uri: original_activity[:id], activity_pub: activity_pub, actor: actor).tap do |a|
a.lock! if o.persisted?
a.content = original_activity.dup
a.content[:object] = object.uri
a.lock! if o.persisted?
a.save!
end
end
@ -107,6 +107,8 @@ class ActivityPub
# @return [Actor]
def actor
@actor ||= ::ActivityPub::Actor.lock.find_or_initialize_by(uri: original_activity[:actor]).tap do |a|
a.lock! if o.persisted?
unless a.instance
a.instance = ::ActivityPub::Instance.lock.find_or_create_by(hostname: URI.parse(a.uri).hostname)
@ -114,8 +116,6 @@ class ActivityPub
end
site.instance_moderations.lock.find_or_create_by(instance: a.instance)
a.lock! if o.persisted?
a.save!
site.actor_moderations.lock.find_or_create_by(actor: a)