diff --git a/README.md b/README.md index 9902977..c6f2762 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Canopy -0.4-INDEV Hotfix 2 +0.4-INDEV Hotfix 3 ========= Canopy - /ˈkæ.nə.pi/: diff --git a/package.json b/package.json index b758038..d01d5aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "canopy-of-indev", - "version": "0.4.2", + "version": "0.4.3", "license": "AGPL-3.0-only", "dependencies": { "@braintree/sanitize-url": "^7.1.1", diff --git a/src/schemas/user/migrationSchema.js b/src/schemas/user/migrationSchema.js index c17ed51..9aff595 100644 --- a/src/schemas/user/migrationSchema.js +++ b/src/schemas/user/migrationSchema.js @@ -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], })