solve bug in demo vault query
This commit is contained in:
parent
32f21445d4
commit
43778d7bca
1 changed files with 23 additions and 3 deletions
|
|
@ -272,16 +272,36 @@ function trackVaultLifecycle(req, res, next) {
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
if (req.path === "/create" && body.id) {
|
if (req.path === "/create" && body.id) {
|
||||||
s.vaults.add(body.id);
|
// body.id is storage-prefixed at this point (outboundTranslator runs after us).
|
||||||
|
// Translate to the user-visible name so it matches what pageLoadHandler queries with.
|
||||||
|
const userName = tryParseUserVaultName(sessionId, body.id);
|
||||||
|
|
||||||
|
if (userName !== null) {
|
||||||
|
s.vaults.add(userName);
|
||||||
|
} else {
|
||||||
|
console.warn(
|
||||||
|
"[demo] trackVaultLifecycle: could not parse user name from create response id:",
|
||||||
|
body.id,
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if (req.path === "/rename") {
|
} else if (req.path === "/rename") {
|
||||||
const oldName = req.body && req.body._origVault;
|
const oldName = req._demoOriginalVault;
|
||||||
|
|
||||||
if (oldName) {
|
if (oldName) {
|
||||||
s.vaults.delete(oldName);
|
s.vaults.delete(oldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.id) {
|
if (body.id) {
|
||||||
s.vaults.add(body.id);
|
const userName = tryParseUserVaultName(sessionId, body.id);
|
||||||
|
|
||||||
|
if (userName !== null) {
|
||||||
|
s.vaults.add(userName);
|
||||||
|
} else {
|
||||||
|
console.warn(
|
||||||
|
"[demo] trackVaultLifecycle: could not parse user name from rename response id:",
|
||||||
|
body.id,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (req.method === "DELETE" && req.path === "/remove") {
|
} else if (req.method === "DELETE" && req.path === "/remove") {
|
||||||
const removed = req._demoOriginalVault;
|
const removed = req._demoOriginalVault;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue