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

@ -9,7 +9,7 @@ Canopy
<a href="https://git.ourfore.st/rainbownapkin/canopy/issues" target="_blank"><img src="https://git.ourfore.st/rainbownapkin/canopy/badges/issues/closed.svg"></a> <a href="https://git.ourfore.st/rainbownapkin/canopy/issues" target="_blank"><img src="https://git.ourfore.st/rainbownapkin/canopy/badges/issues/closed.svg"></a>
<a href="https://www.gnu.org/licenses/agpl-3.0.en.html" target="_blank"><img src="https://img.shields.io/badge/License-AGPL_v3-663366.svg"></a> <a href="https://www.gnu.org/licenses/agpl-3.0.en.html" target="_blank"><img src="https://img.shields.io/badge/License-AGPL_v3-663366.svg"></a>
0.4-INDEV Hotfix 2 0.4-INDEV Hotfix 3
========= =========
Canopy - /ˈkæ.nə.pi/: Canopy - /ˈkæ.nə.pi/:

View file

@ -1,6 +1,6 @@
{ {
"name": "canopy-of-indev", "name": "canopy-of-indev",
"version": "0.4.2", "version": "0.4.3",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"dependencies": { "dependencies": {
"@braintree/sanitize-url": "^7.1.1", "@braintree/sanitize-url": "^7.1.1",

View file

@ -217,13 +217,22 @@ migrationSchema.statics.ingestLegacyUser = async function(rawProfile){
return; 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 //Create migration profile object from scraped info
const migrationProfile = new this({ const migrationProfile = new this({
user: profileArray[1], user: profileArray[1],
pass: profileArray[2], pass: profileArray[2],
//Clamp rank to 0 and the max setting allowed by the rank enum //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]), email: validator.normalizeEmail(profileArray[4]),
date: profileArray[7], date: profileArray[7],
}) })