Add test for user merging

This commit is contained in:
Cooldude2606 authored and Daniel committed 2024-11-22 04:06:34 -08:00
1 parent bdf02a5ea2
commit d80385c947
3 files changed
+66 -4

No files matched your search

+1 -1
View File
@@ -58,7 +58,7 @@ export default class UserManager {
lib.logger.warn(
`A total of ${duplicates} users were merged, a backup was written to: ${backupPath}`
);
await lib.safeOutputFile(backupPath, content);
await lib.safeOutputFile(backupPath, JSON.stringify(content, null, "\t"));
}
} catch (err: any) {
+1 -1
View File
@@ -165,7 +165,7 @@ export default class User {
this.isAdmin = this.isAdmin && otherUser.isAdmin; // More secure to use && rather ||
this.isBanned = this.isBanned || otherUser.isBanned;
this.isBanned = this.isWhitelisted || otherUser.isWhitelisted;
this.banReason = this.banReason.length > otherUser.banReason.length ? this.banReason : otherUser.banReason;
this.banReason = this.updatedAtMs > otherUser.updatedAtMs ? this.banReason : otherUser.banReason;
this.updatedAtMs = Date.now();
// Merge instance stats