mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-29 13:43:41 +01:00
18 lines
523 B
Ruby
18 lines
523 B
Ruby
# frozen_string_literal: true
|
|
|
|
class PrivacyPolicy < ActiveModelSerializers::Model
|
|
DEFAULT_PRIVACY_POLICY = Rails.root.join('config', 'templates', 'privacy-policy.md').read
|
|
DEFAULT_UPDATED_AT = DateTime.new(2022, 10, 7).freeze
|
|
|
|
attributes :updated_at, :text
|
|
|
|
def self.current
|
|
custom = Setting.find_by(var: 'site_terms')
|
|
|
|
if custom&.value.present?
|
|
new(text: custom.value, updated_at: custom.updated_at)
|
|
else
|
|
new(text: DEFAULT_PRIVACY_POLICY, updated_at: DEFAULT_UPDATED_AT)
|
|
end
|
|
end
|
|
end
|