Mods from old codebase now properly migrated. Version number upgraded.

This commit is contained in:
rainbow napkin 2025-11-10 20:11:34 -05:00
parent e7558d7d9d
commit eaca9db987
3 changed files with 12 additions and 3 deletions

View file

@ -217,13 +217,22 @@ migrationSchema.statics.ingestLegacyUser = async function(rawProfile){
return;
}
//Pull rank, dropping over-ranked users down to current enum length
let rank = Math.min(Math.max(0, profileArray[3]), permissionModel.rankEnum.length - 1);
//If this user was a mod on the old site
if(rank == 2){
//Set them up as a mod here
rank = permissionModel.rankEnum.length - 2;
}
//Create migration profile object from scraped info
const migrationProfile = new this({
user: profileArray[1],
pass: profileArray[2],
//Clamp rank to 0 and the max setting allowed by the rank enum
rank: Math.min(Math.max(0, profileArray[3]), permissionModel.rankEnum.length - 1),
rank,
email: validator.normalizeEmail(profileArray[4]),
date: profileArray[7],
})