mirror of https://github.com/mastodon/mastodon
Add effective date to terms of service
parent
b1692628de
commit
7786890326
@ -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
|
@ -0,0 +1,7 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddEffectiveDateToTermsOfServices < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
add_column :terms_of_services, :effective_date, :date
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue