2022-10-08 00:01:11 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class PrivacyPolicy < ActiveModelSerializers::Model
|
2024-01-19 06:22:23 -05:00
|
|
|
DEFAULT_PRIVACY_POLICY = Rails.root.join('config', 'templates', 'privacy-policy.md').read
|
2022-10-08 00:01:11 -04: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-08 02:34:00 -04:00
|
|
|
if custom&.value.present?
|
2022-10-08 00:01:11 -04:00
|
|
|
new(text: custom.value, updated_at: custom.updated_at)
|
|
|
|
else
|
|
|
|
new(text: DEFAULT_PRIVACY_POLICY, updated_at: DEFAULT_UPDATED_AT)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|