2022-10-07 21:01:11 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PrivacyPolicy < ActiveModelSerializers::Model
|
2024-01-19 03:22:23 -08:00
|
|
|
DEFAULT_PRIVACY_POLICY = Rails.root.join('config', 'templates', 'privacy-policy.md').read
|
2022-10-07 21:01:11 -07:00
|
|
|
DEFAULT_UPDATED_AT = DateTime.new(2022, 10, 7).freeze
|
|
|
|
|
|
|
|
attributes :updated_at, :text
|
|
|
|
|
|
|
|
def self.current
|
|
|
|
custom = Setting.find_by(var: 'site_terms')
|
|
|
|
|
2022-10-07 23:34:00 -07:00
|
|
|
if custom&.value.present?
|
2022-10-07 21:01:11 -07:00
|
|
|
new(text: custom.value, updated_at: custom.updated_at)
|
|
|
|
else
|
|
|
|
new(text: DEFAULT_PRIVACY_POLICY, updated_at: DEFAULT_UPDATED_AT)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|