diff --git a/app/controllers/api/v1/webhooks/social_inbox_controller.rb b/app/controllers/api/v1/webhooks/social_inbox_controller.rb index 51322990..c15a757d 100644 --- a/app/controllers/api/v1/webhooks/social_inbox_controller.rb +++ b/app/controllers/api/v1/webhooks/social_inbox_controller.rb @@ -96,8 +96,7 @@ module Api # # @return [ActivityPub::Object] def object - @object ||= ActivityPub::Object.type_from(original_object).find_or_initialize_by(actor: actor, - uri: object_uri).tap do |o| + @object ||= ActivityPub::Object.type_from(original_object).find_or_initialize_by(uri: object_uri).tap do |o| if object_embedded? o.content = original_object else diff --git a/app/models/activity_pub/actor.rb b/app/models/activity_pub/actor.rb index 7be69602..e79a596a 100644 --- a/app/models/activity_pub/actor.rb +++ b/app/models/activity_pub/actor.rb @@ -11,6 +11,5 @@ class ActivityPub belongs_to :instance has_many :activity_pubs, as: :object - has_many :objects end end diff --git a/app/models/activity_pub/object.rb b/app/models/activity_pub/object.rb index 49a06772..ec759e3e 100644 --- a/app/models/activity_pub/object.rb +++ b/app/models/activity_pub/object.rb @@ -7,7 +7,5 @@ class ActivityPub belongs_to :actor has_many :activity_pubs, as: :object - - validates :actor_id, presence: true end end diff --git a/db/migrate/20240221184007_remove_actor_from_objects.rb b/db/migrate/20240221184007_remove_actor_from_objects.rb new file mode 100644 index 00000000..6ee5822c --- /dev/null +++ b/db/migrate/20240221184007_remove_actor_from_objects.rb @@ -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