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