1
0
Fork 0
mirror of synced 2024-06-01 18:20:18 +12:00

Ignore empty name validation on app update and change free logo text

This commit is contained in:
Rory Powell 2022-09-15 14:23:25 +01:00
parent 934bba9562
commit 408fcc725b
4 changed files with 29 additions and 9 deletions

View file

@ -8,7 +8,7 @@
>
<div>
<img src="https://i.imgur.com/Xhdt1YP.png" alt="Budibase" />
<p>Made In Budibase</p>
<p>Made with Budibase</p>
</div>
</Link>

View file

@ -5,7 +5,7 @@
import { FieldTypes } from "constants"
import active from "svelte-spa-router/active"
import { RoleUtils } from "@budibase/frontend-core"
import MadeInBudibase from "../MadeInBudibase.svelte"
import FreeLogo from "../FreeLogo.svelte"
import licensing from "../../licensing"
const sdk = getContext("sdk")
@ -236,7 +236,7 @@
{/if}
{#if !$builderStore.inBuilder && licensing.logoEnabled() && $environmentStore.cloud}
<MadeInBudibase />
<FreeLogo />
{/if}
<div class="main-wrapper">

View file

@ -20,7 +20,7 @@ router
.put(
"/api/applications/:appId",
authorized(BUILDER),
applicationValidator(),
applicationValidator({ isCreate: false }),
controller.update
)
.post(

View file

@ -210,15 +210,35 @@ exports.automationValidator = (existing = false) => {
}).unknown(true))
}
exports.applicationValidator = () => {
exports.applicationValidator = (opts = { isCreate: true }) => {
// prettier-ignore
return joiValidator.body(Joi.object({
const base = {
_id: OPTIONAL_STRING,
_rev: OPTIONAL_STRING,
name: Joi.string().pattern(new RegExp(APP_NAME_REGEX)).required().error(new Error('App name must be letters, numbers and spaces only')),
url: OPTIONAL_STRING,
template: Joi.object({
templateString: OPTIONAL_STRING,
}).unknown(true),
}).unknown(true))
})
}
const appNameValidator = Joi.string()
.pattern(new RegExp(APP_NAME_REGEX))
.error(new Error("App name must be letters, numbers and spaces only"))
if (opts.isCreate) {
base.name = appNameValidator.required()
} else {
base.name = appNameValidator.optional()
}
return joiValidator.body(
Joi.object({
_id: OPTIONAL_STRING,
_rev: OPTIONAL_STRING,
name: appNameValidator,
url: OPTIONAL_STRING,
template: Joi.object({
templateString: OPTIONAL_STRING,
}).unknown(true),
}).unknown(true)
)
}