snapshot_poker_phase5
This commit is contained in:
+36
-12
@@ -474,20 +474,41 @@ async function clearCookieOperation(
|
||||
userId,
|
||||
operationId
|
||||
) {
|
||||
const cookies =
|
||||
getCookieCollection();
|
||||
if (
|
||||
typeof operationId !==
|
||||
"string"
|
||||
||
|
||||
!/^[A-Za-z0-9:_-]{1,160}$/.test(
|
||||
operationId
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
"INVALID_COOKIE_OPERATION_ID"
|
||||
);
|
||||
}
|
||||
|
||||
await cookies.updateOne(
|
||||
{
|
||||
userId
|
||||
},
|
||||
{
|
||||
$pull: {
|
||||
appliedCookieOperations:
|
||||
operationId
|
||||
const {
|
||||
cookies
|
||||
} =
|
||||
getCollections();
|
||||
|
||||
const result =
|
||||
await cookies.updateOne(
|
||||
{
|
||||
userId
|
||||
},
|
||||
{
|
||||
$pull: {
|
||||
appliedCookieOperations:
|
||||
operationId
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
/*
|
||||
* Keep the Cookie document tidy once the final temporary
|
||||
* idempotency marker has been cleared.
|
||||
*/
|
||||
|
||||
await cookies.updateOne(
|
||||
{
|
||||
@@ -503,6 +524,9 @@ async function clearCookieOperation(
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return result.modifiedCount ===
|
||||
1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user