From cdd168f5d3222fc63bdbc8da36236c1b027507a8 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 21 Mar 2024 04:32:35 -0400 Subject: [PATCH] Update `enum` away from deprecated (#29678) --- app/models/relationship_severance_event.rb | 2 +- app/models/severed_relationship.rb | 2 +- lib/mastodon/cli/maintenance.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/relationship_severance_event.rb b/app/models/relationship_severance_event.rb index d9775150e..30ada2576 100644 --- a/app/models/relationship_severance_event.rb +++ b/app/models/relationship_severance_event.rb @@ -16,7 +16,7 @@ class RelationshipSeveranceEvent < ApplicationRecord has_many :severed_relationships, inverse_of: :relationship_severance_event, dependent: :delete_all - enum type: { + enum :type, { domain_block: 0, user_domain_block: 1, account_suspension: 2, diff --git a/app/models/severed_relationship.rb b/app/models/severed_relationship.rb index 00a913f7f..d71b2610f 100644 --- a/app/models/severed_relationship.rb +++ b/app/models/severed_relationship.rb @@ -20,7 +20,7 @@ class SeveredRelationship < ApplicationRecord belongs_to :local_account, class_name: 'Account' belongs_to :remote_account, class_name: 'Account' - enum direction: { + enum :direction, { passive: 0, # analogous to `local_account.passive_relationships` active: 1, # analogous to `local_account.active_relationships` } diff --git a/lib/mastodon/cli/maintenance.rb b/lib/mastodon/cli/maintenance.rb index e6a346ae2..f376bcee0 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -42,7 +42,7 @@ module Mastodon::CLI class SeveredRelationship < ApplicationRecord; end class DomainBlock < ApplicationRecord - enum severity: { silence: 0, suspend: 1, noop: 2 } + enum :severity, { silence: 0, suspend: 1, noop: 2 } scope :by_severity, -> { in_order_of(:severity, %w(noop silence suspend)).order(:domain) } end