5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-18 13:46:21 +00:00

fix: no es necesario vincular actores con objetos

This commit is contained in:
f 2024-02-21 15:42:56 -03:00
parent 34e63ff2dc
commit 03c0b71b5f
No known key found for this signature in database
4 changed files with 13 additions and 5 deletions

View file

@ -96,8 +96,7 @@ module Api
# #
# @return [ActivityPub::Object] # @return [ActivityPub::Object]
def object def object
@object ||= ActivityPub::Object.type_from(original_object).find_or_initialize_by(actor: actor, @object ||= ActivityPub::Object.type_from(original_object).find_or_initialize_by(uri: object_uri).tap do |o|
uri: object_uri).tap do |o|
if object_embedded? if object_embedded?
o.content = original_object o.content = original_object
else else

View file

@ -11,6 +11,5 @@ class ActivityPub
belongs_to :instance belongs_to :instance
has_many :activity_pubs, as: :object has_many :activity_pubs, as: :object
has_many :objects
end end
end end

View file

@ -7,7 +7,5 @@ class ActivityPub
belongs_to :actor belongs_to :actor
has_many :activity_pubs, as: :object has_many :activity_pubs, as: :object
validates :actor_id, presence: true
end end
end end

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
# No es necesario vincular actores con objetos, porque la forma en que
# lo estábamos haciendo no se refiere a le actore del objeto, sino de
# acciones distintas sobre el mismo objeto, generado por une actore.
#
# Y ese valor ya lo podemos obtener desde attributedTo
class RemoveActorFromObjects < ActiveRecord::Migration[6.1]
def change
remove_column :activity_pub_objects, :actor_id, :uuid, index: true
end
end