You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
790 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: account_warnings
  5. #
  6. # id :bigint(8) not null, primary key
  7. # account_id :bigint(8)
  8. # target_account_id :bigint(8)
  9. # action :integer default("none"), not null
  10. # text :text default(""), not null
  11. # created_at :datetime not null
  12. # updated_at :datetime not null
  13. #
  14. class AccountWarning < ApplicationRecord
  15. enum action: %i(none disable silence suspend), _suffix: :action
  16. belongs_to :account, inverse_of: :account_warnings
  17. belongs_to :target_account, class_name: 'Account', inverse_of: :targeted_account_warnings
  18. scope :latest, -> { order(created_at: :desc) }
  19. scope :custom, -> { where.not(text: '') }
  20. end