-
+
Reset your password
diff --git a/packages/builder/src/pages/builder/portal/settings/organisation.svelte b/packages/builder/src/pages/builder/portal/settings/organisation.svelte
index 4e23b12dbd..682b0c4ee9 100644
--- a/packages/builder/src/pages/builder/portal/settings/organisation.svelte
+++ b/packages/builder/src/pages/builder/portal/settings/organisation.svelte
@@ -57,11 +57,17 @@
await organisation.init()
}
- // Update settings
- const res = await organisation.save({
+ const config = {
company: $values.company ?? "",
platformUrl: $values.platformUrl ?? "",
- })
+ }
+ // remove logo if required
+ if (!$values.logo) {
+ config.logoUrl = ""
+ }
+
+ // Update settings
+ const res = await organisation.save(config)
if (res.status === 200) {
notifications.success("Settings saved successfully")
} else {
@@ -98,7 +104,11 @@
{
- $values.logo = e.detail?.[0]
+ if (!e.detail || e.detail.length === 0) {
+ $values.logo = null
+ } else {
+ $values.logo = e.detail[0]
+ }
}}
/>
diff --git a/packages/builder/src/stores/portal/organisation.js b/packages/builder/src/stores/portal/organisation.js
index a0be3a5553..7e6a777cd4 100644
--- a/packages/builder/src/stores/portal/organisation.js
+++ b/packages/builder/src/stores/portal/organisation.js
@@ -13,7 +13,7 @@ export function createOrganisationStore() {
const { subscribe, set } = store
async function init() {
- const res = await api.get(`/api/admin/configs/settings`)
+ const res = await api.get(`/api/admin/configs/public`)
const json = await res.json()
if (json.status === 400) {
diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js
index 27ba636bc8..b5ef087665 100644
--- a/packages/worker/src/api/controllers/admin/configs.js
+++ b/packages/worker/src/api/controllers/admin/configs.js
@@ -98,6 +98,18 @@ exports.find = async function (ctx) {
}
}
+exports.publicSettings = async function (ctx) {
+ const db = new CouchDB(GLOBAL_DB)
+ try {
+ // Find the config with the most granular scope based on context
+ ctx.body = await getScopedFullConfig(db, {
+ type: Configs.SETTINGS,
+ })
+ } catch (err) {
+ ctx.throw(err.status, err)
+ }
+}
+
exports.upload = async function (ctx) {
if (ctx.request.files == null || ctx.request.files.file.length > 1) {
ctx.throw(400, "One file must be uploaded.")
diff --git a/packages/worker/src/api/index.js b/packages/worker/src/api/index.js
index d456778d54..f3153f4b2c 100644
--- a/packages/worker/src/api/index.js
+++ b/packages/worker/src/api/index.js
@@ -37,6 +37,10 @@ const PUBLIC_ENDPOINTS = [
route: "/api/apps",
method: "GET",
},
+ {
+ route: "/api/admin/configs/public",
+ method: "GET",
+ }
]
const router = new Router()
diff --git a/packages/worker/src/api/routes/admin/configs.js b/packages/worker/src/api/routes/admin/configs.js
index c388b83456..8056ad8cbd 100644
--- a/packages/worker/src/api/routes/admin/configs.js
+++ b/packages/worker/src/api/routes/admin/configs.js
@@ -26,7 +26,7 @@ function settingValidation() {
// prettier-ignore
return Joi.object({
platformUrl: Joi.string().optional(),
- logoUrl: Joi.string().optional(),
+ logoUrl: Joi.string().optional().allow("", null),
docsUrl: Joi.string().optional(),
company: Joi.string().required(),
}).unknown(true)
@@ -91,6 +91,7 @@ router
buildConfigGetValidation(),
controller.fetch
)
+ .get("/api/admin/configs/public", controller.publicSettings)
.get("/api/admin/configs/:type", buildConfigGetValidation(), controller.find)
.post(
"/api/admin/configs/upload/:type/:name",