mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
WIP: fix deprecations
This commit is contained in:
parent
16a89f1b56
commit
10b203c300
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
class ApplicationRequest < ActiveRecord::Base
|
||||
enum req_type: {
|
||||
enum :req_type,
|
||||
{
|
||||
http_total: 0,
|
||||
http_2xx: 1,
|
||||
http_background: 2,
|
||||
|
|
|
@ -4,7 +4,7 @@ class DirectoryColumn < ActiveRecord::Base
|
|||
self.ignored_columns = ["automatic"] # TODO: Remove when 20240212034010_drop_deprecated_columns has been promoted to pre-deploy
|
||||
self.inheritance_column = nil
|
||||
|
||||
enum type: { automatic: 0, user_field: 1, plugin: 2 }, _scopes: false
|
||||
enum :type, { automatic: 0, user_field: 1, plugin: 2 }, scopes: false
|
||||
|
||||
def self.automatic_column_names
|
||||
@automatic_column_names ||= %i[
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
class PostHotlinkedMedia < ActiveRecord::Base
|
||||
belongs_to :post
|
||||
belongs_to :upload
|
||||
enum status: {
|
||||
enum :status,
|
||||
{
|
||||
downloaded: "downloaded",
|
||||
too_large: "too_large",
|
||||
download_failed: "download_failed",
|
||||
|
|
|
@ -4,10 +4,10 @@ class ReviewableHistory < ActiveRecord::Base
|
|||
belongs_to :reviewable
|
||||
belongs_to :created_by, class_name: "User"
|
||||
|
||||
enum status: { pending: 0, approved: 1, rejected: 2, ignored: 3, deleted: 4 }
|
||||
enum :status, { pending: 0, approved: 1, rejected: 2, ignored: 3, deleted: 4 }
|
||||
|
||||
alias_attribute :type, :reviewable_history_type
|
||||
enum type: { created: 0, transitioned: 1, edited: 2, claimed: 3, unclaimed: 4 }
|
||||
enum :type, { created: 0, transitioned: 1, edited: 2, claimed: 3, unclaimed: 4 }
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
|
|
|
@ -6,7 +6,7 @@ class ReviewableScore < ActiveRecord::Base
|
|||
belongs_to :reviewed_by, class_name: "User"
|
||||
belongs_to :meta_topic, class_name: "Topic"
|
||||
|
||||
enum status: { pending: 0, agreed: 1, disagreed: 2, ignored: 3 }
|
||||
enum :status, { pending: 0, agreed: 1, disagreed: 2, ignored: 3 }
|
||||
|
||||
# To keep things simple the types correspond to `PostActionType` for backwards
|
||||
# compatibility, but we can add extra reasons for scores.
|
||||
|
|
|
@ -52,7 +52,7 @@ class TranslationOverride < ActiveRecord::Base
|
|||
validate :check_MF_string, if: :message_format?
|
||||
|
||||
attribute :status, :integer
|
||||
enum status: { up_to_date: 0, outdated: 1, invalid_interpolation_keys: 2, deprecated: 3 }
|
||||
enum :status, { up_to_date: 0, outdated: 1, invalid_interpolation_keys: 2, deprecated: 3 }
|
||||
|
||||
scope :mf_locales,
|
||||
->(locale) { not_deprecated.where(locale: locale).where("translation_key LIKE '%_MF'") }
|
||||
|
|
|
@ -25,7 +25,7 @@ class UserOption < ActiveRecord::Base
|
|||
|
||||
scope :human_users, -> { where("user_id > 0") }
|
||||
|
||||
enum default_calendar: { none_selected: 0, ics: 1, google: 2 }, _scopes: false
|
||||
enum :default_calendar, { none_selected: 0, ics: 1, google: 2 }, scopes: false
|
||||
|
||||
def self.ensure_consistency!
|
||||
sql = <<~SQL
|
||||
|
|
|
@ -18,7 +18,8 @@ class WebHookEventType < ActiveRecord::Base
|
|||
TOPIC_VOTING = 17
|
||||
CHAT_MESSAGE = 18
|
||||
|
||||
enum group: {
|
||||
enum :group,
|
||||
{
|
||||
topic: 0,
|
||||
post: 1,
|
||||
user: 2,
|
||||
|
@ -37,7 +38,7 @@ class WebHookEventType < ActiveRecord::Base
|
|||
chat: 15,
|
||||
custom: 16,
|
||||
},
|
||||
_scopes: false
|
||||
scopes: false
|
||||
|
||||
TYPES = {
|
||||
topic_created: 101,
|
||||
|
|
|
@ -9,15 +9,11 @@ class Poll < ActiveRecord::Base
|
|||
has_many :poll_options, -> { order(:id) }, dependent: :destroy
|
||||
has_many :poll_votes
|
||||
|
||||
enum type: { regular: 0, multiple: 1, number: 2, ranked_choice: 3 }, _scopes: false
|
||||
|
||||
enum status: { open: 0, closed: 1 }, _scopes: false
|
||||
|
||||
enum results: { always: 0, on_vote: 1, on_close: 2, staff_only: 3 }, _scopes: false
|
||||
|
||||
enum visibility: { secret: 0, everyone: 1 }, _scopes: false
|
||||
|
||||
enum chart_type: { bar: 0, pie: 1 }, _scopes: false
|
||||
enum :type, { regular: 0, multiple: 1, number: 2, ranked_choice: 3 }, scopes: false
|
||||
enum :status, { open: 0, closed: 1 }, scopes: false
|
||||
enum :results, { always: 0, on_vote: 1, on_close: 2, staff_only: 3 }, scopes: false
|
||||
enum :visibility, { secret: 0, everyone: 1 }, scopes: false
|
||||
enum :chart_type, { bar: 0, pie: 1 }, scopes: false
|
||||
|
||||
validates :min, numericality: { allow_nil: true, only_integer: true, greater_than_or_equal_to: 0 }
|
||||
validates :max, numericality: { allow_nil: true, only_integer: true, greater_than: 0 }
|
||||
|
|
Loading…
Reference in New Issue
Block a user