Merge pull request #6060 from Budibase/fix/update-icon-context
Explicitly passing requested appId when calling updateAppPackage
This commit is contained in:
commit
245d0237f9
|
@ -314,6 +314,7 @@ function getContextDB(key, opts) {
|
||||||
toUseAppId = getDevelopmentAppID(appId)
|
toUseAppId = getDevelopmentAppID(appId)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
db = dangerousGetDB(toUseAppId, opts)
|
db = dangerousGetDB(toUseAppId, opts)
|
||||||
try {
|
try {
|
||||||
cls.setOnContext(key, db)
|
cls.setOnContext(key, db)
|
||||||
|
|
|
@ -49,6 +49,7 @@ const {
|
||||||
getAppDB,
|
getAppDB,
|
||||||
getProdAppDB,
|
getProdAppDB,
|
||||||
updateAppId,
|
updateAppId,
|
||||||
|
doInAppContext,
|
||||||
} = require("@budibase/backend-core/context")
|
} = require("@budibase/backend-core/context")
|
||||||
import { getUniqueRows } from "../../utilities/usageQuota/rows"
|
import { getUniqueRows } from "../../utilities/usageQuota/rows"
|
||||||
import { quotas } from "@budibase/pro"
|
import { quotas } from "@budibase/pro"
|
||||||
|
@ -548,22 +549,24 @@ export const sync = async (ctx: any, next: any) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateAppPackage = async (appPackage: any, appId: any) => {
|
const updateAppPackage = async (appPackage: any, appId: any) => {
|
||||||
const db = getAppDB()
|
return doInAppContext(appId, async () => {
|
||||||
const application = await db.get(DocumentTypes.APP_METADATA)
|
const db = getAppDB()
|
||||||
|
const application = await db.get(DocumentTypes.APP_METADATA)
|
||||||
|
|
||||||
const newAppPackage = { ...application, ...appPackage }
|
const newAppPackage = { ...application, ...appPackage }
|
||||||
if (appPackage._rev !== application._rev) {
|
if (appPackage._rev !== application._rev) {
|
||||||
newAppPackage._rev = application._rev
|
newAppPackage._rev = application._rev
|
||||||
}
|
}
|
||||||
|
|
||||||
// the locked by property is attached by server but generated from
|
// the locked by property is attached by server but generated from
|
||||||
// Redis, shouldn't ever store it
|
// Redis, shouldn't ever store it
|
||||||
delete newAppPackage.lockedBy
|
delete newAppPackage.lockedBy
|
||||||
|
|
||||||
await db.put(newAppPackage)
|
await db.put(newAppPackage)
|
||||||
// remove any cached metadata, so that it will be updated
|
// remove any cached metadata, so that it will be updated
|
||||||
await appCache.invalidateAppMetadata(appId)
|
await appCache.invalidateAppMetadata(appId)
|
||||||
return newAppPackage
|
return newAppPackage
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const createEmptyAppPackage = async (ctx: any, app: any) => {
|
const createEmptyAppPackage = async (ctx: any, app: any) => {
|
||||||
|
|
Loading…
Reference in New Issue