Merge remote-tracking branch 'parent/main' into upstream-20240310
This commit is contained in:
commit
5979c0ea1d
345 changed files with 4304 additions and 2540 deletions
|
@ -61,6 +61,9 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
urls: {
|
||||
streaming: Rails.configuration.x.streaming_api_base_url,
|
||||
status: object.status_page_url,
|
||||
about: about_url,
|
||||
privacy_policy: privacy_policy_url,
|
||||
terms_of_service: TermsOfService.live.exists? ? terms_of_service_url : nil,
|
||||
},
|
||||
|
||||
vapid: {
|
||||
|
|
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