Fixing an issue with portal calls causing the app to be re-locked.
This commit is contained in:
parent
6cb40d4450
commit
fa0544054b
|
@ -32,6 +32,9 @@ exports.getRedisOptions = (clustered = false) => {
|
|||
}
|
||||
|
||||
exports.addDbPrefix = (db, key) => {
|
||||
if (key.includes(db)) {
|
||||
return key
|
||||
}
|
||||
return `${db}${SEPARATOR}${key}`
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ const fetch = require("node-fetch")
|
|||
const env = require("../../environment")
|
||||
const { checkSlashesInUrl } = require("../../utilities")
|
||||
const { request } = require("../../utilities/workerRequests")
|
||||
const { getGlobalIDFromUserMetadataID } = require("../../db/utils")
|
||||
const { clearLock } = require("../../utilities/redis")
|
||||
|
||||
async function redirect(ctx, method) {
|
||||
|
@ -35,7 +34,7 @@ exports.redirectDelete = async ctx => {
|
|||
await redirect(ctx, "DELETE")
|
||||
}
|
||||
|
||||
exports.removeLock = async ctx => {
|
||||
exports.clearLock = async ctx => {
|
||||
const { appId } = ctx.params
|
||||
try {
|
||||
await clearLock(appId, ctx.user)
|
||||
|
|
|
@ -16,7 +16,7 @@ if (env.isDev() || env.isTest()) {
|
|||
router.delete(
|
||||
"/api/dev/:appId/lock",
|
||||
authorized(BUILDER),
|
||||
controller.removeLock
|
||||
controller.clearLock
|
||||
)
|
||||
|
||||
module.exports = router
|
||||
|
|
|
@ -41,9 +41,10 @@ module.exports = (permType, permLevel = null) => async (ctx, next) => {
|
|||
}
|
||||
|
||||
const builderCall = permType === PermissionTypes.BUILDER
|
||||
|
||||
const referer = ctx.headers["referer"]
|
||||
const editingApp = referer ? referer.includes(ctx.appId) : false
|
||||
// this makes sure that builder calls abide by dev locks
|
||||
if (builderCall) {
|
||||
if (builderCall && editingApp) {
|
||||
await checkDevAppLocks(ctx)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue