username scrub WIP

scrub-username
Thibault Duplessis 2021-04-13 08:31:22 +02:00
parent b68b90cab8
commit 76e7322f8c
1 changed files with 21 additions and 0 deletions

View File

@ -32,6 +32,19 @@ const ghostId = `!${randomId()}`;
const tos =
user.marks && (user.marks.engine || user.marks.boost || user.marks.troll || user.marks.rankban || user.marks.alt);
// Let us scrub.
scrub('activity')(c => c.remove({ _id: new RegExp(`^${userId}:`) }));
scrub('analysis_requester')(c => c.remove({ _id: userId }));
scrub('bookmark')(c => c.remove({ u: userId }));
scrub('challenge')(c => {
c.remove({ 'challenger.id': userId });
c.remove({ 'destUser.id': userId });
});
scrub('clas_clas')(c => {
c.updateMany({ 'created.by': userId }, { $set: { 'created.by': ghostId } });
c.updateMany({ teachers: userId }, { $pull: { teachers: userId } });
@ -39,6 +52,14 @@ scrub('clas_clas')(c => {
scrub('clas_student')(c => c.remove({ userId: userId }));
scrub('coach')(c => c.remove({ _id: userId }));
scrub('coach_review')(c => c.remove({ userId: userId }));
scrub('config')(c => c.remove({ _id: userId }));
scrub('coordinate_score')(c => c.remove({ _id: userId }));
scrub('crosstable2')(c => c.remove({ _id: new RegExp(`^${userId}/`) }));
scrub('eval_cache')(c => c.updateMany({ 'evals.by': userId }, { $set: { 'evals.$.by': ghostId } }));