mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 05:26:22 +00:00
fix: arreglar las relaciones entre actividades y objetos
This commit is contained in:
parent
c57794b54e
commit
5bf26a7fb2
2 changed files with 16 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue