From 93ebb6431a211d75f462c86163ec9fbc5e9ea73d Mon Sep 17 00:00:00 2001 From: f Date: Tue, 19 Mar 2024 11:20:49 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20buscar=20un=20c=C3=B3digo=20de=20respues?= =?UTF-8?q?ta=20general?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/activity_pub/actor_fetch_job.rb | 2 +- app/jobs/activity_pub/fetch_job.rb | 2 +- app/jobs/activity_pub/inbox_job.rb | 2 +- app/jobs/activity_pub/instance_fetch_job.rb | 2 +- app/jobs/activity_pub/remote_flag_job.rb | 2 +- app/jobs/activity_pub/sync_lists_job.rb | 2 +- app/models/activity_pub/fediblock.rb | 2 +- app/models/deploy_social_distributed_press.rb | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/jobs/activity_pub/actor_fetch_job.rb b/app/jobs/activity_pub/actor_fetch_job.rb index 1190e936..598ecd83 100644 --- a/app/jobs/activity_pub/actor_fetch_job.rb +++ b/app/jobs/activity_pub/actor_fetch_job.rb @@ -16,7 +16,7 @@ class ActivityPub response = site.social_inbox.dereferencer.get(uri: actor.uri) # @todo Fallar cuando la respuesta no funcione? - return unless response.ok? + return unless response.success? return if response.miss? && actor.content.present? actor.object.update(content: FastJsonparser.parse(response.body)) diff --git a/app/jobs/activity_pub/fetch_job.rb b/app/jobs/activity_pub/fetch_job.rb index 9d14307a..beb585ff 100644 --- a/app/jobs/activity_pub/fetch_job.rb +++ b/app/jobs/activity_pub/fetch_job.rb @@ -22,7 +22,7 @@ class ActivityPub # @todo Fallar cuando la respuesta no funcione? # @todo Eliminar en 410 Gone - return unless response.ok? + return unless response.success? # Ignorar si ya la caché fue revalidada y ya teníamos el # contenido return if response.hit? && object.content.present? diff --git a/app/jobs/activity_pub/inbox_job.rb b/app/jobs/activity_pub/inbox_job.rb index 93216d44..cb807704 100644 --- a/app/jobs/activity_pub/inbox_job.rb +++ b/app/jobs/activity_pub/inbox_job.rb @@ -10,7 +10,7 @@ class ActivityPub def perform(site:, activity:, action:) response = site.social_inbox.inbox.public_send(action, id: activity) - raise response.body unless response.ok? + raise response.body unless response.success? end end end diff --git a/app/jobs/activity_pub/instance_fetch_job.rb b/app/jobs/activity_pub/instance_fetch_job.rb index 9c562f7d..dc84caf2 100644 --- a/app/jobs/activity_pub/instance_fetch_job.rb +++ b/app/jobs/activity_pub/instance_fetch_job.rb @@ -15,7 +15,7 @@ class ActivityPub response = site.social_inbox.dereferencer.get(uri: uri) - next unless response.ok? + next unless response.success? # @todo Validate schema next unless response.parsed_response.is_a?(DistributedPress::V1::Social::ReferencedObject) diff --git a/app/jobs/activity_pub/remote_flag_job.rb b/app/jobs/activity_pub/remote_flag_job.rb index 71751d39..f586a92e 100644 --- a/app/jobs/activity_pub/remote_flag_job.rb +++ b/app/jobs/activity_pub/remote_flag_job.rb @@ -25,7 +25,7 @@ class ActivityPub client = remote_flag.main_site.social_inbox.client_for(uri.origin) response = client.post(endpoint: uri.path, body: remote_flag.content) - raise 'No se pudo enviar el reporte' unless response.ok? + raise 'No se pudo enviar el reporte' unless response.success? remote_flag.report! rescue Exception => e diff --git a/app/jobs/activity_pub/sync_lists_job.rb b/app/jobs/activity_pub/sync_lists_job.rb index 39f6bdc9..cc500bee 100644 --- a/app/jobs/activity_pub/sync_lists_job.rb +++ b/app/jobs/activity_pub/sync_lists_job.rb @@ -53,7 +53,7 @@ class ActivityPub def process(stage) response = yield - return if response.ok? + return if response.success? logs[stage] ||= [] logs[stage] << { body: response.body, code: response.code } diff --git a/app/models/activity_pub/fediblock.rb b/app/models/activity_pub/fediblock.rb index ec66c032..17897d79 100644 --- a/app/models/activity_pub/fediblock.rb +++ b/app/models/activity_pub/fediblock.rb @@ -52,7 +52,7 @@ class ActivityPub def process! response = client.get(download_url) - raise FediblockDownloadError unless response.ok? + raise FediblockDownloadError unless response.success? Fediblock.transaction do csv = response.parsed_response diff --git a/app/models/deploy_social_distributed_press.rb b/app/models/deploy_social_distributed_press.rb index c7a103a4..e7f97406 100644 --- a/app/models/deploy_social_distributed_press.rb +++ b/app/models/deploy_social_distributed_press.rb @@ -84,7 +84,7 @@ class DeploySocialDistributedPress < Deploy response = hook_client.put(event: event, hook: webhook) - raise ArgumentError, response.body unless response.ok? + raise ArgumentError, response.body unless response.success? rescue ArgumentError => e ExceptionNotifier.notify_exception(e, data: { site_id: site.name, usuarie_id: rol.usuarie_id }) end