Mods from old codebase now properly migrated. Version number upgraded.
This commit is contained in:
parent
e7558d7d9d
commit
eaca9db987
3 changed files with 12 additions and 3 deletions
|
|
@ -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],
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue