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