Merge branch 'master' into v3-ui
This commit is contained in:
commit
20ed18a0e2
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||||
"version": "2.33.12",
|
"version": "2.33.13",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
|
|
|
@ -406,7 +406,7 @@
|
||||||
allowSelectRows={!readonly}
|
allowSelectRows={!readonly}
|
||||||
{customRenderers}
|
{customRenderers}
|
||||||
loading={!$fetch.loaded || !groupsLoaded}
|
loading={!$fetch.loaded || !groupsLoaded}
|
||||||
defaultSortColumn={"__selectable"}
|
defaultSortColumn={"access"}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
"../string-templates"
|
"../string-templates"
|
||||||
],
|
],
|
||||||
"ext": "js,ts,json,svelte",
|
"ext": "js,ts,json,svelte",
|
||||||
"ignore": ["**/*.spec.ts", "**/*.spec.js", "../*/dist/**/*"],
|
"ignore": ["**/*.spec.ts", "**/*.spec.js", "../*/dist/**/*", "client/**/*", "builder/**/*"],
|
||||||
"exec": "yarn build && node --no-node-snapshot ./dist/index.js"
|
"exec": "yarn build && node --no-node-snapshot ./dist/index.js"
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,16 @@ const requiresMigration = async (ctx: Ctx) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const serveApp = async function (ctx: UserCtx) {
|
export const serveApp = async function (ctx: UserCtx) {
|
||||||
|
if (ctx.url.includes("apple-touch-icon.png")) {
|
||||||
|
ctx.redirect("/builder/bblogo.png")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// no app ID found, cannot serve - return message instead
|
||||||
|
if (!context.getAppId()) {
|
||||||
|
ctx.body = "No content found - requires app ID"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const needMigrations = await requiresMigration(ctx)
|
const needMigrations = await requiresMigration(ctx)
|
||||||
|
|
||||||
const bbHeaderEmbed =
|
const bbHeaderEmbed =
|
||||||
|
|
|
@ -152,4 +152,22 @@ describe("/static", () => {
|
||||||
expect(res.body.builderPreview).toBe(true)
|
expect(res.body.builderPreview).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("/", () => {
|
||||||
|
it("should move permanently from base call (public call)", async () => {
|
||||||
|
const res = await request.get(`/`)
|
||||||
|
expect(res.status).toEqual(301)
|
||||||
|
expect(res.text).toEqual(
|
||||||
|
`Redirecting to <a href="/builder">/builder</a>.`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should not error when trying to get 'apple-touch-icon.png' (public call)", async () => {
|
||||||
|
const res = await request.get(`/apple-touch-icon.png`)
|
||||||
|
expect(res.status).toEqual(302)
|
||||||
|
expect(res.text).toEqual(
|
||||||
|
`Redirecting to <a href="/builder/bblogo.png">/builder/bblogo.png</a>.`
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,10 +25,12 @@ export async function fetch(status: AppStatus, user: ContextUser) {
|
||||||
const all = status === AppStatus.ALL
|
const all = status === AppStatus.ALL
|
||||||
let apps = (await dbCore.getAllApps({ dev, all })) as App[]
|
let apps = (await dbCore.getAllApps({ dev, all })) as App[]
|
||||||
|
|
||||||
const enrichedUser = await groups.enrichUserRolesFromGroups({
|
// need to type this correctly - add roles back in to convert from ContextUser to User
|
||||||
|
const completeUser: User = {
|
||||||
...user,
|
...user,
|
||||||
roles: user.roles || {},
|
roles: user?.roles || {},
|
||||||
})
|
}
|
||||||
|
const enrichedUser = await groups.enrichUserRolesFromGroups(completeUser)
|
||||||
apps = filterAppList(enrichedUser, apps)
|
apps = filterAppList(enrichedUser, apps)
|
||||||
|
|
||||||
const appIds = apps
|
const appIds = apps
|
||||||
|
|
|
@ -312,16 +312,21 @@ export const tenantUserLookup = async (ctx: any) => {
|
||||||
* So the account holder may not be found until further pagination has occurred
|
* So the account holder may not be found until further pagination has occurred
|
||||||
*/
|
*/
|
||||||
export const accountHolderLookup = async (ctx: Ctx) => {
|
export const accountHolderLookup = async (ctx: Ctx) => {
|
||||||
|
try {
|
||||||
const users = await userSdk.core.getAllUsers()
|
const users = await userSdk.core.getAllUsers()
|
||||||
const response = await userSdk.core.getExistingAccounts(
|
const response = await userSdk.core.getExistingAccounts(
|
||||||
users.map(u => u.email)
|
users.map(u => u.email)
|
||||||
)
|
)
|
||||||
const holder = response[0]
|
const holder = response[0]
|
||||||
if (!holder) {
|
if (!holder) {
|
||||||
|
ctx.body = null
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
holder._id = users.find(u => u.email === holder.email)?._id
|
holder._id = users.find(u => u.email === holder.email)?._id
|
||||||
ctx.body = holder
|
ctx.body = holder
|
||||||
|
} catch (e) {
|
||||||
|
ctx.body = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue