Class: Upgrade::UpdateActorsJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/upgrade/update_actors_job.rb

Instance Method Summary collapse

Instance Method Details

#perform ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/jobs/upgrade/update_actors_job.rb', line 8

def perform
  if SiteSettings.federation_enabled?
    # Fix incorrectly-flagged local actors
    Federails::Actor.where(local: true)
      .where.not(server: [PublicUrl.hostname, nil])
      .update_all(local: false) # rubocop:disable Rails/SkipsModelValidations
    # Fix incorrect entity type fields
    Federails::Actor.where(entity_id: nil)
      .where.not(entity_type: nil)
      .update_all(entity_type: nil) # rubocop:disable Rails/SkipsModelValidations
    # Update remove actor data
    Federails::Maintenance::ActorsUpdater.run
  end
end