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 03529d1450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

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

View File

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

View File

@ -139,8 +139,13 @@ module.exports.disableEscaping = string => {
if (matches == null) { if (matches == null) {
return string 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 return string
} }

View File

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