Merge pull request #4549 from Budibase/fix/screen-creation-roles

Fix role being stale when creating screens
This commit is contained in:
Andrew Kingston 2022-02-22 12:51:12 +00:00 committed by GitHub
commit 3dcbb2e74a
4 changed files with 14 additions and 4 deletions

View File

@ -12,11 +12,12 @@
let screenName = ""
let url = ""
let selectedScreens = []
let roleId = $selectedAccessRole || "BASIC"
let showProgressCircle = false
let routeError
let createdScreens = []
$: roleId = $selectedAccessRole || "BASIC"
const createScreens = async () => {
for (let screen of selectedScreens) {
let test = screen.create()

View File

@ -90,7 +90,7 @@
</script>
<DrawerContent>
<div className="container">
<div class="container">
<Layout noPadding>
<Body size="S">
{#if !filters?.length}

View File

@ -139,8 +139,13 @@ module.exports.disableEscaping = string => {
if (matches == null) {
return string
}
for (let match of matches) {
string = string.replace(match, `{${match}}`)
// find the unique set
const unique = [...new Set(matches)]
for (let match of unique) {
// add a negative lookahead to exclude any already
const regex = new RegExp(`${match}(?!})`, "g")
string = string.replace(regex, `{${match}}`)
}
return string
}

View File

@ -194,5 +194,9 @@ describe("check that disabling escaping function works", () => {
it("should work with a combination", () => {
expect(disableEscaping("{{ name }} welcome to {{{ platform }}}")).toEqual("{{{ name }}} welcome to {{{ platform }}}")
})
it("should work with multiple escaped", () => {
expect(disableEscaping("{{ name }} welcome to {{ name }}")).toEqual("{{{ name }}} welcome to {{{ name }}}")
})
})