mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 07:26:23 +00:00
fix: buscar un código de respuesta general
This commit is contained in:
parent
48d8d2d8d8
commit
93ebb6431a
8 changed files with 8 additions and 8 deletions
|
@ -16,7 +16,7 @@ class ActivityPub
|
||||||
response = site.social_inbox.dereferencer.get(uri: actor.uri)
|
response = site.social_inbox.dereferencer.get(uri: actor.uri)
|
||||||
|
|
||||||
# @todo Fallar cuando la respuesta no funcione?
|
# @todo Fallar cuando la respuesta no funcione?
|
||||||
return unless response.ok?
|
return unless response.success?
|
||||||
return if response.miss? && actor.content.present?
|
return if response.miss? && actor.content.present?
|
||||||
|
|
||||||
actor.object.update(content: FastJsonparser.parse(response.body))
|
actor.object.update(content: FastJsonparser.parse(response.body))
|
||||||
|
|
|
@ -22,7 +22,7 @@ class ActivityPub
|
||||||
|
|
||||||
# @todo Fallar cuando la respuesta no funcione?
|
# @todo Fallar cuando la respuesta no funcione?
|
||||||
# @todo Eliminar en 410 Gone
|
# @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
|
# Ignorar si ya la caché fue revalidada y ya teníamos el
|
||||||
# contenido
|
# contenido
|
||||||
return if response.hit? && object.content.present?
|
return if response.hit? && object.content.present?
|
||||||
|
|
|
@ -10,7 +10,7 @@ class ActivityPub
|
||||||
def perform(site:, activity:, action:)
|
def perform(site:, activity:, action:)
|
||||||
response = site.social_inbox.inbox.public_send(action, id: activity)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ class ActivityPub
|
||||||
|
|
||||||
response = site.social_inbox.dereferencer.get(uri: uri)
|
response = site.social_inbox.dereferencer.get(uri: uri)
|
||||||
|
|
||||||
next unless response.ok?
|
next unless response.success?
|
||||||
# @todo Validate schema
|
# @todo Validate schema
|
||||||
next unless response.parsed_response.is_a?(DistributedPress::V1::Social::ReferencedObject)
|
next unless response.parsed_response.is_a?(DistributedPress::V1::Social::ReferencedObject)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ActivityPub
|
||||||
client = remote_flag.main_site.social_inbox.client_for(uri.origin)
|
client = remote_flag.main_site.social_inbox.client_for(uri.origin)
|
||||||
response = client.post(endpoint: uri.path, body: remote_flag.content)
|
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!
|
remote_flag.report!
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ActivityPub
|
||||||
def process(stage)
|
def process(stage)
|
||||||
response = yield
|
response = yield
|
||||||
|
|
||||||
return if response.ok?
|
return if response.success?
|
||||||
|
|
||||||
logs[stage] ||= []
|
logs[stage] ||= []
|
||||||
logs[stage] << { body: response.body, code: response.code }
|
logs[stage] << { body: response.body, code: response.code }
|
||||||
|
|
|
@ -52,7 +52,7 @@ class ActivityPub
|
||||||
def process!
|
def process!
|
||||||
response = client.get(download_url)
|
response = client.get(download_url)
|
||||||
|
|
||||||
raise FediblockDownloadError unless response.ok?
|
raise FediblockDownloadError unless response.success?
|
||||||
|
|
||||||
Fediblock.transaction do
|
Fediblock.transaction do
|
||||||
csv = response.parsed_response
|
csv = response.parsed_response
|
||||||
|
|
|
@ -84,7 +84,7 @@ class DeploySocialDistributedPress < Deploy
|
||||||
|
|
||||||
response = hook_client.put(event: event, hook: webhook)
|
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
|
rescue ArgumentError => e
|
||||||
ExceptionNotifier.notify_exception(e, data: { site_id: site.name, usuarie_id: rol.usuarie_id })
|
ExceptionNotifier.notify_exception(e, data: { site_id: site.name, usuarie_id: rol.usuarie_id })
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue