From 019101ba1e07448eceec8e390070f632420d72bc Mon Sep 17 00:00:00 2001 From: f Date: Wed, 6 Mar 2024 15:54:47 -0300 Subject: [PATCH] feat: almacenar el perfil de le actore en la base de datos --- app/jobs/activity_pub/actor_fetch_job.rb | 2 +- app/models/activity_pub/actor.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/jobs/activity_pub/actor_fetch_job.rb b/app/jobs/activity_pub/actor_fetch_job.rb index 71107151..1190e936 100644 --- a/app/jobs/activity_pub/actor_fetch_job.rb +++ b/app/jobs/activity_pub/actor_fetch_job.rb @@ -19,7 +19,7 @@ class ActivityPub return unless response.ok? return if response.miss? && actor.content.present? - actor.update(content: FastJsonparser.parse(response.body)) + actor.object.update(content: FastJsonparser.parse(response.body)) end end end diff --git a/app/models/activity_pub/actor.rb b/app/models/activity_pub/actor.rb index fe6052bf..0a39dcde 100644 --- a/app/models/activity_pub/actor.rb +++ b/app/models/activity_pub/actor.rb @@ -25,5 +25,13 @@ class ActivityPub @mention ||= "@#{content['preferredUsername']}@#{instance.hostname}" end + + def object + @object ||= ActivityPub::Object::Person.find_or_initialize_by(uri: uri) + end + + def content + object.content + end end end