1
0
Fork 0
mirror of synced 2024-07-02 21:10:43 +12:00

Review updates

This commit is contained in:
Dean 2023-03-27 18:00:57 +01:00
parent 6db03768e6
commit 4de8333f80
3 changed files with 29 additions and 13 deletions

View file

@ -271,6 +271,31 @@ export async function publicOidc(ctx: Ctx<void, GetPublicOIDCConfigResponse>) {
}
}
export async function getLicensedConfig() {
let licensedConfig: object = {}
const defaults = {
emailBrandingEnabled: true,
testimonialsEnabled: true,
platformTitle: undefined,
metaDescription: undefined,
metaImageUrl: undefined,
metaTitle: undefined,
}
try {
// License/Feature Checks
const license = await licensing.getLicense()
if (!license || license?.features.indexOf(Feature.BRANDING) == -1) {
licensedConfig = { ...defaults }
}
} catch (e) {
licensedConfig = { ...defaults }
console.info("Could not retrieve license", e)
}
return licensedConfig
}
export async function publicSettings(
ctx: Ctx<void, GetPublicSettingsResponse>
) {
@ -279,18 +304,7 @@ export async function publicSettings(
const configDoc = await configs.getSettingsConfigDoc()
const config = configDoc.config
// License/Feature Checks
const license = await licensing.getLicense()
const licensedConfig: any = {}
if (!license || license?.features.indexOf(Feature.BRANDING) == -1) {
licensedConfig["emailBrandingEnabled"] = true
licensedConfig["testimonialsEnabled"] = true
licensedConfig["platformTitle"] = undefined
licensedConfig["metaDescription"] = undefined
licensedConfig["metaImageUrl"] = undefined
licensedConfig["metaTitle"] = undefined
}
const licensedConfig: object = await getLicensedConfig()
// enrich the logo url - empty url means deleted
if (config.logoUrl && config.logoUrl !== "") {

View file

@ -286,6 +286,7 @@ describe("configs", () => {
type: "settings",
config: {
company: "Budibase",
emailBrandingEnabled: true,
logoUrl: "",
analyticsEnabled: false,
google: false,
@ -294,6 +295,7 @@ describe("configs", () => {
oidc: false,
oidcCallbackUrl: `http://localhost:10000/api/global/auth/${config.tenantId}/oidc/callback`,
platformUrl: "http://localhost:10000",
testimonialsEnabled: true,
},
}
delete body._rev

View file

@ -111,7 +111,7 @@ async function buildEmail(
])
// Change from branding to core
let core = EmailTemplates.core
let core = EmailTemplates[EmailTemplatePurpose.CORE]
if (!base || !body || !core) {
throw "Unable to build email, missing base components"