Fixing userId storage to redis and making sure lockedBy property never stored.
This commit is contained in:
parent
31901c89f8
commit
28a7282a8b
|
@ -138,6 +138,9 @@ exports.fetch = async function (ctx) {
|
||||||
const lock = locks.find(lock => lock.appId === app._id)
|
const lock = locks.find(lock => lock.appId === app._id)
|
||||||
if (lock) {
|
if (lock) {
|
||||||
app.lockedBy = lock.user
|
app.lockedBy = lock.user
|
||||||
|
} else {
|
||||||
|
// make sure its definitely not present
|
||||||
|
delete app.lockedBy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,6 +225,12 @@ exports.update = async function (ctx) {
|
||||||
const data = ctx.request.body
|
const data = ctx.request.body
|
||||||
const newData = { ...application, ...data, url }
|
const newData = { ...application, ...data, url }
|
||||||
|
|
||||||
|
// the locked by property is attached by server but generated from
|
||||||
|
// Redis, shouldn't ever store it
|
||||||
|
if (newData.lockedBy) {
|
||||||
|
delete newData.lockedBy
|
||||||
|
}
|
||||||
|
|
||||||
const response = await db.put(newData)
|
const response = await db.put(newData)
|
||||||
data._rev = response.rev
|
data._rev = response.rev
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,11 @@ exports.getAllLocks = async () => {
|
||||||
|
|
||||||
exports.updateLock = async (devAppId, user) => {
|
exports.updateLock = async (devAppId, user) => {
|
||||||
// make sure always global user ID
|
// make sure always global user ID
|
||||||
|
const globalId = getGlobalIDFromUserMetadataID(user._id)
|
||||||
const inputUser = {
|
const inputUser = {
|
||||||
...user,
|
...user,
|
||||||
_id: getGlobalIDFromUserMetadataID(user._id),
|
userId: globalId,
|
||||||
|
_id: globalId,
|
||||||
}
|
}
|
||||||
await devAppClient.store(devAppId, inputUser, APP_DEV_LOCK_SECONDS)
|
await devAppClient.store(devAppId, inputUser, APP_DEV_LOCK_SECONDS)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue