5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-10-07 23:36:57 +00:00

Merge branch 'issue-15109-1' of https://0xacab.org/sutty/sutty into production.panel.sutty.nl

This commit is contained in:
Sutty 2024-03-19 14:21:50 +00:00
commit e196918957
8 changed files with 9 additions and 8 deletions

View file

@ -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))

View file

@ -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?

View file

@ -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

View file

@ -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)

View file

@ -25,11 +25,12 @@ 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
ExceptionNotifier.notify_exception(e, data: { remote_flag: remote_flag.id, response: response.parsed_response }) ExceptionNotifier.notify_exception(e, data: { remote_flag: remote_flag.id, response: response.parsed_response })
remote_flag.resend!
raise raise
end end
end end

View file

@ -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 }

View file

@ -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

View file

@ -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