pull/1128/head
parent
d60cfe27fa
commit
a54a6d57ab
|
@ -13,16 +13,16 @@ class Log < ApplicationRecord
|
|||
|
||||
# Why "EMAIL_ISH"? Because `fatal_email` is LIKE '%email%', but it's probably
|
||||
# not the one you want.
|
||||
IS_EMAIL_ISH = "channels LIKE '%email%'"
|
||||
IS_EMAIL_ISH = "channels LIKE '%email%'"
|
||||
IS_FATAL_EMAIL = "channels LIKE '%fatal_email%'"
|
||||
DISCARD = ["fun", "debug", nil]
|
||||
TYPES = CeleryScriptSettingsBag::ALLOWED_MESSAGE_TYPES
|
||||
DISCARD = ["fun", "debug", nil]
|
||||
TYPES = CeleryScriptSettingsBag::ALLOWED_MESSAGE_TYPES
|
||||
# The means by which the message will be sent. Ex: frontend toast notification
|
||||
serialize :channels
|
||||
serialize :channels
|
||||
belongs_to :device
|
||||
|
||||
validates :device, presence: true
|
||||
validates :type, presence: true
|
||||
validates :type, presence: true
|
||||
serialize :meta
|
||||
validates :meta, presence: true
|
||||
# http://stackoverflow.com/a/5127684/1064917
|
||||
|
@ -36,20 +36,21 @@ class Log < ApplicationRecord
|
|||
# TODO: Remove these once FBOS stops using the `meta` field (FBOS < v6.4.0).
|
||||
def meta
|
||||
{
|
||||
type: self.type,
|
||||
type: self.type,
|
||||
major_version: self.major_version,
|
||||
minor_version: self.minor_version,
|
||||
verbosity: self.verbosity,
|
||||
x: self.x,
|
||||
y: self.y,
|
||||
z: self.z,
|
||||
verbosity: self.verbosity,
|
||||
x: self.x,
|
||||
y: self.y,
|
||||
z: self.z,
|
||||
}
|
||||
end
|
||||
|
||||
def meta=(hash)
|
||||
hash.map { |(key, value)| self.send("#{key}=", value) }
|
||||
hash.map { |(key, value)| self.send("#{key}=", value) }
|
||||
self.meta
|
||||
end
|
||||
|
||||
# End Legacy shims ===========================================================
|
||||
|
||||
def broadcast? # Logs get their own special channel. Don't echo twice!
|
||||
|
|
Loading…
Reference in New Issue