mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 16:23:44 +08:00
3137e60653
This PR introduces a basic AdminNotice model to store these notices. Admin notices are categorized by their source/type (currently only notices from problem check.) They also have a priority.
34 lines
814 B
Ruby
34 lines
814 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AdminNotice < ActiveRecord::Base
|
|
validates :identifier, presence: true
|
|
|
|
enum :priority, %i[low high].freeze
|
|
enum :subject, %i[problem].freeze
|
|
|
|
def message
|
|
I18n.t(
|
|
"dashboard.#{subject}.#{identifier}",
|
|
**details.symbolize_keys.merge(base_path: Discourse.base_path),
|
|
)
|
|
end
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: admin_notices
|
|
#
|
|
# id :bigint not null, primary key
|
|
# subject :integer not null
|
|
# priority :integer not null
|
|
# identifier :string not null
|
|
# details :json not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_admin_notices_on_subject (subject)
|
|
# index_admin_notices_on_identifier (identifier)
|
|
#
|