about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2023-02-19 23:00:36 -0500
committerGitHub <noreply@github.com>2023-02-20 05:00:36 +0100
commit63e63538861bd850a38a282e37de046639afa993 (patch)
tree6163b8725c595af0cc40460b0ff2a5eee5988ffc /app
parent44a7d87cb1f5df953b6c14c16c59e2e4ead1bcb9 (diff)
Autofix Rubocop Rails/EnumHash (#23737)
Diffstat (limited to 'app')
-rw-r--r--app/models/account.rb4
-rw-r--r--app/models/custom_filter.rb2
-rw-r--r--app/models/domain_block.rb2
-rw-r--r--app/models/import.rb2
-rw-r--r--app/models/list.rb2
-rw-r--r--app/models/media_attachment.rb4
-rw-r--r--app/models/preview_card.rb4
-rw-r--r--app/models/relay.rb2
-rw-r--r--app/models/status.rb2
9 files changed, 12 insertions, 12 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 2c0cd577e..d33110d55 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -78,8 +78,8 @@ class Account < ApplicationRecord
   include DomainMaterializable
   include AccountMerging
 
-  enum protocol: [:ostatus, :activitypub]
-  enum suspension_origin: [:local, :remote], _prefix: true
+  enum protocol: { ostatus: 0, activitypub: 1 }
+  enum suspension_origin: { local: 0, remote: 1 }, _prefix: true
 
   validates :username, presence: true
   validates_with UniqueUsernameValidator, if: -> { will_save_change_to_username? }
diff --git a/app/models/custom_filter.rb b/app/models/custom_filter.rb
index b70e53bd5..781bf4db8 100644
--- a/app/models/custom_filter.rb
+++ b/app/models/custom_filter.rb
@@ -30,7 +30,7 @@ class CustomFilter < ApplicationRecord
   include Expireable
   include Redisable
 
-  enum action: [:warn, :hide], _suffix: :action
+  enum action: { warn: 0, hide: 1 }, _suffix: :action
 
   belongs_to :account
   has_many :keywords, class_name: 'CustomFilterKeyword', inverse_of: :custom_filter, dependent: :destroy
diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb
index 8e298ac9d..190f5ba2e 100644
--- a/app/models/domain_block.rb
+++ b/app/models/domain_block.rb
@@ -20,7 +20,7 @@ class DomainBlock < ApplicationRecord
   include DomainNormalizable
   include DomainMaterializable
 
-  enum severity: [:silence, :suspend, :noop]
+  enum severity: { silence: 0, suspend: 1, noop: 2 }
 
   validates :domain, presence: true, uniqueness: true, domain: true
 
diff --git a/app/models/import.rb b/app/models/import.rb
index 00a54892e..cd33eb07b 100644
--- a/app/models/import.rb
+++ b/app/models/import.rb
@@ -24,7 +24,7 @@ class Import < ApplicationRecord
 
   belongs_to :account
 
-  enum type: [:following, :blocking, :muting, :domain_blocking, :bookmarks]
+  enum type: { following: 0, blocking: 1, muting: 2, domain_blocking: 3, bookmarks: 4 }
 
   validates :type, presence: true
   validates_with ImportValidator, on: :create
diff --git a/app/models/list.rb b/app/models/list.rb
index cdc6ebdb3..7b8cf6636 100644
--- a/app/models/list.rb
+++ b/app/models/list.rb
@@ -16,7 +16,7 @@ class List < ApplicationRecord
 
   PER_ACCOUNT_LIMIT = 50
 
-  enum replies_policy: [:list, :followed, :none], _prefix: :show
+  enum replies_policy: { list: 0, followed: 1, none: 2 }, _prefix: :show
 
   belongs_to :account, optional: true
 
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb
index 5916b0b4b..c6f2352e0 100644
--- a/app/models/media_attachment.rb
+++ b/app/models/media_attachment.rb
@@ -33,8 +33,8 @@ class MediaAttachment < ApplicationRecord
 
   include Attachmentable
 
-  enum type: [:image, :gifv, :video, :unknown, :audio]
-  enum processing: [:queued, :in_progress, :complete, :failed], _prefix: true
+  enum type: { :image => 0, :gifv => 1, :video => 2, :unknown => 3, :audio => 4 }
+  enum processing: { :queued => 0, :in_progress => 1, :complete => 2, :failed => 3 }, _prefix: true
 
   MAX_DESCRIPTION_LENGTH = 1_500
 
diff --git a/app/models/preview_card.rb b/app/models/preview_card.rb
index 56ca62d5e..d25fe6dad 100644
--- a/app/models/preview_card.rb
+++ b/app/models/preview_card.rb
@@ -44,8 +44,8 @@ class PreviewCard < ApplicationRecord
 
   self.inheritance_column = false
 
-  enum type: [:link, :photo, :video, :rich]
-  enum link_type: [:unknown, :article]
+  enum type: { link: 0, photo: 1, video: 2, rich: 3 }
+  enum link_type: { unknown: 0, article: 1 }
 
   has_and_belongs_to_many :statuses
   has_one :trend, class_name: 'PreviewCardTrend', inverse_of: :preview_card, dependent: :destroy
diff --git a/app/models/relay.rb b/app/models/relay.rb
index c66bfe4ff..e9c425743 100644
--- a/app/models/relay.rb
+++ b/app/models/relay.rb
@@ -14,7 +14,7 @@
 class Relay < ApplicationRecord
   validates :inbox_url, presence: true, uniqueness: true, url: true, if: :will_save_change_to_inbox_url?
 
-  enum state: [:idle, :pending, :accepted, :rejected]
+  enum state: { idle: 0, pending: 1, accepted: 2, rejected: 3 }
 
   scope :enabled, -> { accepted }
 
diff --git a/app/models/status.rb b/app/models/status.rb
index e0ad29103..44a297a08 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -48,7 +48,7 @@ class Status < ApplicationRecord
 
   update_index('statuses', :proper)
 
-  enum visibility: [:public, :unlisted, :private, :direct, :limited], _suffix: :visibility
+  enum visibility: { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4 }, _suffix: :visibility
 
   belongs_to :application, class_name: 'Doorkeeper::Application', optional: true