mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Show Privacy Policy or ToS when they exist (#21771)
Privacy Policy and Terms of Service topics are no longer created by default for communities that have not set a company name. For this reason, some URLs were pointing to 404 page.
This commit is contained in:
@@ -41,6 +41,8 @@ class SiteSerializer < ApplicationSerializer
|
||||
:anonymous_sidebar_sections,
|
||||
:whispers_allowed_groups_names,
|
||||
:denied_emojis,
|
||||
:tos_url,
|
||||
:privacy_policy_url,
|
||||
)
|
||||
|
||||
has_many :archetypes, embed: :objects, serializer: ArchetypeSerializer
|
||||
@@ -285,6 +287,30 @@ class SiteSerializer < ApplicationSerializer
|
||||
denied_emojis.present?
|
||||
end
|
||||
|
||||
def tos_url
|
||||
if SiteSetting.tos_url.present?
|
||||
SiteSetting.tos_url
|
||||
elsif SiteSetting.tos_topic_id > 0 && Topic.exists?(id: SiteSetting.tos_topic_id)
|
||||
"#{Discourse.base_path}/tos"
|
||||
end
|
||||
end
|
||||
|
||||
def include_tos_url?
|
||||
tos_url.present?
|
||||
end
|
||||
|
||||
def privacy_policy_url
|
||||
if SiteSetting.privacy_policy_url.present?
|
||||
SiteSetting.privacy_policy_url
|
||||
elsif SiteSetting.privacy_topic_id > 0 && Topic.exists?(id: SiteSetting.privacy_topic_id)
|
||||
"#{Discourse.base_path}/privacy"
|
||||
end
|
||||
end
|
||||
|
||||
def include_privacy_policy_url?
|
||||
privacy_policy_url.present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def ordered_flags(flags)
|
||||
|
||||
Reference in New Issue
Block a user