Review updates
This commit is contained in:
parent
6db03768e6
commit
4de8333f80
|
@ -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(
|
export async function publicSettings(
|
||||||
ctx: Ctx<void, GetPublicSettingsResponse>
|
ctx: Ctx<void, GetPublicSettingsResponse>
|
||||||
) {
|
) {
|
||||||
|
@ -279,18 +304,7 @@ export async function publicSettings(
|
||||||
const configDoc = await configs.getSettingsConfigDoc()
|
const configDoc = await configs.getSettingsConfigDoc()
|
||||||
const config = configDoc.config
|
const config = configDoc.config
|
||||||
|
|
||||||
// License/Feature Checks
|
const licensedConfig: object = await getLicensedConfig()
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// enrich the logo url - empty url means deleted
|
// enrich the logo url - empty url means deleted
|
||||||
if (config.logoUrl && config.logoUrl !== "") {
|
if (config.logoUrl && config.logoUrl !== "") {
|
||||||
|
|
|
@ -286,6 +286,7 @@ describe("configs", () => {
|
||||||
type: "settings",
|
type: "settings",
|
||||||
config: {
|
config: {
|
||||||
company: "Budibase",
|
company: "Budibase",
|
||||||
|
emailBrandingEnabled: true,
|
||||||
logoUrl: "",
|
logoUrl: "",
|
||||||
analyticsEnabled: false,
|
analyticsEnabled: false,
|
||||||
google: false,
|
google: false,
|
||||||
|
@ -294,6 +295,7 @@ describe("configs", () => {
|
||||||
oidc: false,
|
oidc: false,
|
||||||
oidcCallbackUrl: `http://localhost:10000/api/global/auth/${config.tenantId}/oidc/callback`,
|
oidcCallbackUrl: `http://localhost:10000/api/global/auth/${config.tenantId}/oidc/callback`,
|
||||||
platformUrl: "http://localhost:10000",
|
platformUrl: "http://localhost:10000",
|
||||||
|
testimonialsEnabled: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
delete body._rev
|
delete body._rev
|
||||||
|
|
|
@ -111,7 +111,7 @@ async function buildEmail(
|
||||||
])
|
])
|
||||||
|
|
||||||
// Change from branding to core
|
// Change from branding to core
|
||||||
let core = EmailTemplates.core
|
let core = EmailTemplates[EmailTemplatePurpose.CORE]
|
||||||
|
|
||||||
if (!base || !body || !core) {
|
if (!base || !body || !core) {
|
||||||
throw "Unable to build email, missing base components"
|
throw "Unable to build email, missing base components"
|
||||||
|
|
Loading…
Reference in New Issue