5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 09:46:23 +00:00

Merge branch 'issue-15109-1' of https://0xacab.org/sutty/sutty into production.panel.sutty.nl

This commit is contained in:
Sutty 2024-03-22 21:29:24 +00:00
commit a8cc5c0094
2 changed files with 4 additions and 4 deletions

View file

@ -9,7 +9,7 @@ class ActivityPub
def perform(site:, hostnames:, perform_remotely: true) def perform(site:, hostnames:, perform_remotely: true)
# Crear las instancias que no existan todavía # Crear las instancias que no existan todavía
hostnames.each do |hostname| hostnames.each do |hostname|
ActivityPub::Instance.find_or_create_by(hostname: hostname) ActivityPub::Instance.lock.find_or_create_by(hostname: hostname)
end end
instances = ActivityPub::Instance.where(hostname: hostnames) instances = ActivityPub::Instance.where(hostname: hostnames)
@ -20,7 +20,7 @@ class ActivityPub
instances.find_each do |instance| instances.find_each do |instance|
# Esto bloquea cada una individualmente en la Social Inbox, # Esto bloquea cada una individualmente en la Social Inbox,
# idealmente son pocas instancias las que aparecen. # idealmente son pocas instancias las que aparecen.
site.instance_moderations.find_or_create_by(instance: instance) site.instance_moderations.lock.find_or_create_by(instance: instance)
end end
scope = site.instance_moderations.where(instance_id: instances.ids) scope = site.instance_moderations.where(instance_id: instances.ids)

View file

@ -94,7 +94,7 @@ class ActivityPub
.type_from(original_activity) .type_from(original_activity)
.lock .lock
.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.lock! if o.persisted? a.lock! if a.persisted?
a.content = original_activity.dup a.content = original_activity.dup
a.content[:object] = object.uri a.content[:object] = object.uri
a.save! a.save!
@ -107,7 +107,7 @@ class ActivityPub
# @return [Actor] # @return [Actor]
def actor def actor
@actor ||= ::ActivityPub::Actor.lock.find_or_initialize_by(uri: original_activity[:actor]).tap do |a| @actor ||= ::ActivityPub::Actor.lock.find_or_initialize_by(uri: original_activity[:actor]).tap do |a|
a.lock! if o.persisted? a.lock! if a.persisted?
unless a.instance unless a.instance
a.instance = ::ActivityPub::Instance.lock.find_or_create_by(hostname: URI.parse(a.uri).hostname) a.instance = ::ActivityPub::Instance.lock.find_or_create_by(hostname: URI.parse(a.uri).hostname)