0
0
Fork 0

Add effective date to terms of service (#33993)

This commit is contained in:
Eugen Rochko 2025-03-05 10:01:33 +01:00 committed by GitHub
parent 84164270c6
commit cadda2f957
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
67 changed files with 201 additions and 126 deletions

View file

@ -5,12 +5,18 @@ class Api::V1::Instances::TermsOfServicesController < Api::V1::Instances::BaseCo
def show
cache_even_if_authenticated!
render json: @terms_of_service, serializer: REST::PrivacyPolicySerializer
render json: @terms_of_service, serializer: REST::TermsOfServiceSerializer
end
private
def set_terms_of_service
@terms_of_service = TermsOfService.live.first!
@terms_of_service = begin
if params[:date].present?
TermsOfService.published.find_by!(effective_date: params[:date])
else
TermsOfService.live.first || TermsOfService.published.first! # For the case when none of the published terms have become effective yet
end
end
end
end