FIX: do not include contact url & email in client site settings payload (#13004)

This commit is contained in:
Arpit Jalan
2021-05-19 11:45:24 +05:30
committed by GitHub
parent 85b0bcfbdc
commit f96f534f3e
7 changed files with 117 additions and 29 deletions

View File

@@ -6,20 +6,15 @@ import { gt } from "@ember/object/computed";
export default Controller.extend({
faqOverriden: gt("siteSettings.faq_url.length", 0),
@discourseComputed
contactInfo() {
if (this.siteSettings.contact_url) {
@discourseComputed("model.contact_url", "model.contact_email")
contactInfo(url, email) {
if (url) {
return I18n.t("about.contact_info", {
contact_info:
"<a href='" +
this.siteSettings.contact_url +
"' target='_blank'>" +
this.siteSettings.contact_url +
"</a>",
contact_info: `<a href='${url}' target='_blank'>${url}</a>`,
});
} else if (this.siteSettings.contact_email) {
} else if (email) {
return I18n.t("about.contact_info", {
contact_info: this.siteSettings.contact_email,
contact_info: email,
});
} else {
return null;

View File

@@ -11,17 +11,6 @@ export default {
secret: false,
type: "string"
},
{
setting: "contact_email",
description:
"Email address of key contact responsible for this site. Used for critical notifications and displayed on the /about page for urgent matters.",
default: "",
value: "",
category: "required",
preview: null,
secret: false,
type: "email"
},
{
setting: "site_contact_username",
description:

View File

@@ -22,11 +22,9 @@ class AboutSerializer < ApplicationSerializer
:locale,
:version,
:https,
:can_see_about_stats
def can_see_about_stats
scope.can_see_about_stats?
end
:can_see_about_stats,
:contact_url,
:contact_email
def include_stats?
can_see_about_stats
@@ -35,4 +33,30 @@ class AboutSerializer < ApplicationSerializer
def stats
object.class.fetch_cached_stats || Jobs::AboutStats.new.execute({})
end
def include_contact_url?
can_see_site_contact_details
end
def contact_url
SiteSetting.contact_url
end
def include_contact_email?
can_see_site_contact_details
end
def contact_email
SiteSetting.contact_email
end
private
def can_see_about_stats
scope.can_see_about_stats?
end
def can_see_site_contact_details
scope.can_see_site_contact_details?
end
end