snapshot_poker_uiux_cleanup_2
This commit is contained in:
@@ -470,6 +470,46 @@ async function changeCookiesOnce(
|
||||
}
|
||||
|
||||
|
||||
async function clearCookieOperation(
|
||||
userId,
|
||||
operationId
|
||||
) {
|
||||
if (
|
||||
typeof operationId !==
|
||||
"string"
|
||||
||
|
||||
!/^[A-Za-z0-9:_-]{1,160}$/.test(
|
||||
operationId
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
"INVALID_COOKIE_OPERATION_ID"
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
cookies
|
||||
} =
|
||||
getCollections();
|
||||
|
||||
const result =
|
||||
await cookies.updateOne(
|
||||
{
|
||||
userId
|
||||
},
|
||||
{
|
||||
$pull: {
|
||||
appliedCookieOperations:
|
||||
operationId
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return result.modifiedCount ===
|
||||
1;
|
||||
}
|
||||
|
||||
|
||||
async function hasCookieOperation(
|
||||
userId,
|
||||
operationId
|
||||
@@ -1435,6 +1475,7 @@ module.exports = {
|
||||
changeCookies,
|
||||
changeCookiesOnce,
|
||||
hasCookieOperation,
|
||||
clearCookieOperation,
|
||||
transferCookies,
|
||||
|
||||
getCooldown,
|
||||
|
||||
Reference in New Issue
Block a user