5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 05:16:21 +00:00

fix: arreglar las relaciones entre actividades y objetos

This commit is contained in:
f 2024-03-14 12:27:59 -03:00
parent c57794b54e
commit 5bf26a7fb2
No known key found for this signature in database
2 changed files with 16 additions and 0 deletions

View file

@ -24,9 +24,13 @@ class ActivityPub
return unless response.ok?
return if response.miss? && object.content.present?
current_type = object.type
content = FastJsonparser.parse(response.body)
object.update(content: content, type: ActivityPub::Object.type_from(content).name)
# Arreglar las relaciones con actividades también
ActivityPub.where(object_id: object.id).update_all(object_type: object.type) unless current_type == object.type
end
end
end

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
# Arregla la relación rota entre ActivityPub y Objects
class FixObjectTypeOnActivityPubs < ActiveRecord::Migration[6.1]
def up
ActivityPub::Object.where.not(type: 'ActivityPub::Object::Generic').find_each do |object|
ActivityPub.where(object_id: object.id).update_all(type: object.type, updated_at: Time.now)
end
end
def down; end
end