From 5cc97ba4000f6eaf3c35916606bab229af1448da Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 29 Jun 2022 13:08:48 +0100 Subject: [PATCH 1/3] Delete checkList cache on destroy --- packages/backend-core/cache.js | 1 + packages/server/yarn.lock | 18 +++++++++--------- .../src/api/controllers/global/configs.js | 3 ++- packages/worker/yarn.lock | 18 +++++++++--------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/packages/backend-core/cache.js b/packages/backend-core/cache.js index 6b319357c4..c8bd3c9b6f 100644 --- a/packages/backend-core/cache.js +++ b/packages/backend-core/cache.js @@ -5,4 +5,5 @@ module.exports = { app: require("./src/cache/appMetadata"), writethrough: require("./src/cache/writethrough"), ...generic, + cache: generic, } diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 82d7943354..7dd2021116 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1028,10 +1028,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.212": - version "1.0.212" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.212.tgz#7ce8bfa8c968f4aa7558bd2dd13ad3e1e3e40c8f" - integrity sha512-pCrAHr54d2onSbaUoCWP83LMJnm28PNIpBAmAhi2kNdSfaGTFY/Iw1sbGOE3G/9vNaB+RRXeibKEEPFjToOgAg== +"@budibase/backend-core@1.0.213": + version "1.0.213" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.213.tgz#da10d014b5e39457413a9b7f6ead54322d482855" + integrity sha512-ARqPhrev/da9WNXVIYSXN5M+cYLKSBYL7pvVVcwMXewp6KCR0gdUBHxuksnrmTbxqT43h7Uc/Zg1H/jYc1xQQQ== dependencies: "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1109,12 +1109,12 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.0.212": - version "1.0.212" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.212.tgz#d6d2528b9ec2ec47e79d3360d04feeb5d2900d1e" - integrity sha512-RcbDmz3pkReUHXAJDPzvgTYy0CBksw55XLbW0wNtDu2HVWP0ZXoiMMJjOxNDwMfL3q4eZitWgISa7QUDisDtMA== +"@budibase/pro@1.0.213": + version "1.0.213" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.213.tgz#80e6005bec51927d373d278dd8d8672c2f25a4d5" + integrity sha512-zhTMPZBv0IkQsdKz1ywnWaxmt/PMrw/EkW1dS8bIOAqHgFTUgawiMGrqrzH43Iw3JemMK7AvtI1EOhs+zrMWVg== dependencies: - "@budibase/backend-core" "1.0.212" + "@budibase/backend-core" "1.0.213" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": diff --git a/packages/worker/src/api/controllers/global/configs.js b/packages/worker/src/api/controllers/global/configs.js index 227b86d181..47873bb3ab 100644 --- a/packages/worker/src/api/controllers/global/configs.js +++ b/packages/worker/src/api/controllers/global/configs.js @@ -18,6 +18,7 @@ const { withCache, CacheKeys, bustCache, + cache, } = require("@budibase/backend-core/cache") const { events } = require("@budibase/backend-core") @@ -365,9 +366,9 @@ exports.upload = async function (ctx) { exports.destroy = async function (ctx) { const db = getGlobalDB() const { id, rev } = ctx.params - try { await db.remove(id, rev) + cache.delete(CacheKeys.CHECKLIST) ctx.body = { message: "Config deleted successfully" } } catch (err) { ctx.throw(err.status, err) diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 96cc5c5750..4c394647a7 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,10 +291,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.212": - version "1.0.212" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.212.tgz#7ce8bfa8c968f4aa7558bd2dd13ad3e1e3e40c8f" - integrity sha512-pCrAHr54d2onSbaUoCWP83LMJnm28PNIpBAmAhi2kNdSfaGTFY/Iw1sbGOE3G/9vNaB+RRXeibKEEPFjToOgAg== +"@budibase/backend-core@1.0.213": + version "1.0.213" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.213.tgz#da10d014b5e39457413a9b7f6ead54322d482855" + integrity sha512-ARqPhrev/da9WNXVIYSXN5M+cYLKSBYL7pvVVcwMXewp6KCR0gdUBHxuksnrmTbxqT43h7Uc/Zg1H/jYc1xQQQ== dependencies: "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -322,12 +322,12 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.0.212": - version "1.0.212" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.212.tgz#d6d2528b9ec2ec47e79d3360d04feeb5d2900d1e" - integrity sha512-RcbDmz3pkReUHXAJDPzvgTYy0CBksw55XLbW0wNtDu2HVWP0ZXoiMMJjOxNDwMfL3q4eZitWgISa7QUDisDtMA== +"@budibase/pro@1.0.213": + version "1.0.213" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.213.tgz#80e6005bec51927d373d278dd8d8672c2f25a4d5" + integrity sha512-zhTMPZBv0IkQsdKz1ywnWaxmt/PMrw/EkW1dS8bIOAqHgFTUgawiMGrqrzH43Iw3JemMK7AvtI1EOhs+zrMWVg== dependencies: - "@budibase/backend-core" "1.0.212" + "@budibase/backend-core" "1.0.213" node-fetch "^2.6.1" "@cspotcode/source-map-consumer@0.8.0": From 3016874fca92b63f26f2fcd62f5e037923495fb4 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 29 Jun 2022 13:12:51 +0100 Subject: [PATCH 2/3] Use default config when resetting smtp --- .../src/pages/builder/portal/manage/email/index.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/portal/manage/email/index.svelte b/packages/builder/src/pages/builder/portal/manage/email/index.svelte index 53c881b65b..812aa5b014 100644 --- a/packages/builder/src/pages/builder/portal/manage/email/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/email/index.svelte @@ -74,7 +74,10 @@ rev: smtpConfig._rev, }) smtpConfig = { - config: {}, + type: ConfigTypes.SMTP, + config: { + secure: true, + }, } await admin.getChecklist() notifications.success(`Settings cleared`) From 7049ef7381417a9c44d92d0d5e6f254234d2e3fa Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 8 Jul 2022 14:53:34 +0100 Subject: [PATCH 3/3] Add await to cache delete --- packages/worker/src/api/controllers/global/configs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/worker/src/api/controllers/global/configs.js b/packages/worker/src/api/controllers/global/configs.js index 41b9853ad5..54de62a2aa 100644 --- a/packages/worker/src/api/controllers/global/configs.js +++ b/packages/worker/src/api/controllers/global/configs.js @@ -368,7 +368,7 @@ exports.destroy = async function (ctx) { const { id, rev } = ctx.params try { await db.remove(id, rev) - cache.delete(CacheKeys.CHECKLIST) + await cache.delete(CacheKeys.CHECKLIST) ctx.body = { message: "Config deleted successfully" } } catch (err) { ctx.throw(err.status, err)