From 342521c897d77243e63fcbb565651eba7ae0f80d Mon Sep 17 00:00:00 2001 From: f Date: Tue, 27 Feb 2024 16:54:09 -0300 Subject: [PATCH] fix: guardar los datos de la instancia --- app/jobs/activity_pub/instance_fetch_job.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/jobs/activity_pub/instance_fetch_job.rb b/app/jobs/activity_pub/instance_fetch_job.rb index 0ceb1a8a..ce202092 100644 --- a/app/jobs/activity_pub/instance_fetch_job.rb +++ b/app/jobs/activity_pub/instance_fetch_job.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true class ActivityPub - # Obtiene o actualiza los datos de una instancia. + # Obtiene o actualiza los datos de una instancia. Usamos un cliente + # de ActivityPub porque la instancia podría estar en federación + # limitada. class InstanceFetchJob < ApplicationJob self.priority = 100 @@ -14,8 +16,10 @@ class ActivityPub response = site.social_inbox.dereferencer.get(uri: uri) next unless response.ok? + # @todo Validate schema + next unless response.parsed_response.is_a?(DistributedPress::V1::Social::ReferencedObject) - instance.update(content: response.parsed_response) + instance.update(content: response.parsed_response.object) break end