fix: check for total challenge completion before donation pop up (#57425)

This commit is contained in:
Ahmad Abdolsaheb
2024-12-14 00:56:06 +03:00
committed by GitHub
parent 1690afeb95
commit bf253db285
4 changed files with 57 additions and 16 deletions

View File

@@ -10,7 +10,8 @@ const {
blankUser,
publicUser,
fullyCertifiedUser,
userIds
userIds,
almostFullyCertifiedUser
} = require('./user-data');
const options = {
@@ -18,7 +19,8 @@ const options = {
'top-contributor': { type: 'boolean' },
'set-false': { type: 'string', multiple: true },
'seed-trophy-challenges': { type: 'boolean' },
'certified-user': { type: 'boolean' }
'certified-user': { type: 'boolean' },
'almost-certified-user': { type: 'boolean' }
};
const { values: argValues } = parseArgs({ options });
@@ -124,13 +126,15 @@ const run = async () => {
await dropUsers();
if (argValues['certified-user']) {
await user.insertOne(fullyCertifiedUser);
await user.insertOne(blankUser);
await user.insertOne(publicUser);
} else if (argValues['almost-certified-user']) {
await user.insertOne(almostFullyCertifiedUser);
} else {
await user.insertOne(demoUser);
await user.insertOne(blankUser);
await user.insertOne(publicUser);
}
await user.insertOne(blankUser);
await user.insertOne(publicUser);
log('local auth user seed complete');
};

View File

@@ -5,8 +5,15 @@ const blankUserId = new ObjectId('5bd30e0f1caf6ac3ddddddb9');
const publicUserId = new ObjectId('663b839b24a8b29f57728b13');
const demoUserId = new ObjectId('5bd30e0f1caf6ac3ddddddb5');
const fullyCertifiedUserId = new ObjectId('5fa2db00a25c1c1fa49ce067');
const almostFullyCertifiedUserId = new ObjectId('5bd30e0f1caf6ac3ddddddb9');
const userIds = [blankUserId, publicUserId, demoUserId, fullyCertifiedUserId];
const userIds = [
blankUserId,
publicUserId,
demoUserId,
fullyCertifiedUserId,
almostFullyCertifiedUserId
];
module.exports.blankUser = {
_id: blankUserId,
@@ -12287,4 +12294,13 @@ module.exports.fullyCertifiedUser = {
unsubscribeId: 'tBX8stC5jiustPBteF2mV'
};
module.exports.almostFullyCertifiedUser = {
...module.exports.fullyCertifiedUser,
id: almostFullyCertifiedUserId,
completedChallenges:
module.exports.fullyCertifiedUser.completedChallenges.filter(
challenge => challenge.id !== 'bd7158d8c442eddfaeb5bd13'
)
};
module.exports.userIds = userIds;