mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-18 13:36:21 +00:00
fix: no es necesario vincular actores con objetos
This commit is contained in:
parent
34e63ff2dc
commit
03c0b71b5f
4 changed files with 13 additions and 5 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
12
db/migrate/20240221184007_remove_actor_from_objects.rb
Normal file
12
db/migrate/20240221184007_remove_actor_from_objects.rb
Normal 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
|
Loading…
Reference in a new issue