Add effective date to terms of service (#33993)
This commit is contained in:
parent
84164270c6
commit
cadda2f957
67 changed files with 201 additions and 126 deletions
27
app/serializers/rest/terms_of_service_serializer.rb
Normal file
27
app/serializers/rest/terms_of_service_serializer.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::TermsOfServiceSerializer < ActiveModel::Serializer
|
||||
attributes :effective_date, :effective, :content, :succeeded_by
|
||||
|
||||
def effective_date
|
||||
object.effective_date.iso8601
|
||||
end
|
||||
|
||||
def effective
|
||||
object.effective?
|
||||
end
|
||||
|
||||
def succeeded_by
|
||||
object.succeeded_by&.effective_date&.iso8601
|
||||
end
|
||||
|
||||
def content
|
||||
markdown.render(format(object.text, domain: Rails.configuration.x.local_domain))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def markdown
|
||||
@markdown ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, escape_html: true, no_images: true)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue