diff --git a/.github/cla/signatures.json b/.github/cla/signatures.json index 67d475a7a3..8fcde8353e 100644 --- a/.github/cla/signatures.json +++ b/.github/cla/signatures.json @@ -31,6 +31,14 @@ "created_at": "2021-05-01T05:27:53Z", "repoId": 190729906, "pullRequestNo": 1431 + }, + { + "name": "mjashanks", + "id": 3524181, + "comment_id": 844846454, + "created_at": "2021-05-20T08:14:04Z", + "repoId": 190729906, + "pullRequestNo": 1510 } ] } \ No newline at end of file diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 91a682d859..93217277e7 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -34,6 +34,10 @@ exports.APP_PREFIX = DocumentTypes.APP + SEPARATOR exports.APP_DEV_PREFIX = DocumentTypes.APP_DEV + SEPARATOR exports.SEPARATOR = SEPARATOR +function isDevApp(app) { + return app.appId.startsWith(exports.APP_DEV_PREFIX) +} + /** * If creating DB allDocs/query params with only a single top level ID this can be used, this * is usually the case as most of our docs are top level e.g. tables, automations, users and so on. @@ -160,7 +164,7 @@ exports.getDeployedAppID = appId => { * different users/companies apps as there is no security around it - all apps are returned. * @return {Promise} returns the app information document stored in each app database. */ -exports.getAllApps = async (devApps = false) => { +exports.getAllApps = async ({ dev, all } = {}) => { const CouchDB = getCouch() let allDbs = await CouchDB.allDbs() const appDbNames = allDbs.filter(dbName => @@ -176,12 +180,19 @@ exports.getAllApps = async (devApps = false) => { const apps = response .filter(result => result.status === "fulfilled") .map(({ value }) => value) - return apps.filter(app => { - if (devApps) { - return app.appId.startsWith(exports.APP_DEV_PREFIX) - } - return !app.appId.startsWith(exports.APP_DEV_PREFIX) - }) + if (!all) { + return apps.filter(app => { + if (dev) { + return isDevApp(app) + } + return !isDevApp(app) + }) + } else { + return apps.map(app => ({ + ...app, + status: isDevApp(app) ? "development" : "published", + })) + } } } diff --git a/packages/auth/src/utils.js b/packages/auth/src/utils.js index a0ba0d25b5..278ad07174 100644 --- a/packages/auth/src/utils.js +++ b/packages/auth/src/utils.js @@ -112,6 +112,9 @@ exports.isClient = ctx => { * @return {Promise} */ exports.getGlobalUserByEmail = async email => { + if (email == null) { + throw "Must supply an email address to view" + } const db = getDB(StaticDatabases.GLOBAL.name) try { let users = ( diff --git a/packages/bbui/src/Form/Core/Checkbox.svelte b/packages/bbui/src/Form/Core/Checkbox.svelte index 7d564d2a9d..e9a6b56fd9 100644 --- a/packages/bbui/src/Form/Core/Checkbox.svelte +++ b/packages/bbui/src/Form/Core/Checkbox.svelte @@ -45,3 +45,9 @@ {text || ""} + + diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte index 5b5c72b809..3315c923f8 100644 --- a/packages/bbui/src/Form/Core/Dropzone.svelte +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -37,9 +37,28 @@ const fieldId = id || generateID() let selectedImageIdx = 0 let fileDragged = false + let selectedUrl $: selectedImage = value?.[selectedImageIdx] ?? null $: fileCount = value?.length ?? 0 - $: isImage = imageExtensions.includes(selectedImage?.extension?.toLowerCase()) + $: isImage = + imageExtensions.includes(selectedImage?.extension?.toLowerCase()) || + selectedImage?.type?.startsWith("image") + + $: { + if (selectedImage?.url) { + selectedUrl = selectedImage?.url + } else if (selectedImage) { + try { + let reader = new FileReader() + reader.readAsDataURL(selectedImage) + reader.onload = e => { + selectedUrl = e.target.result + } + } catch (error) { + selectedUrl = null + } + } + } async function processFileList(fileList) { if ( @@ -102,11 +121,13 @@