Make real name and other properties optional - pass 1

This commit is contained in:
Bryan Ashby
2023-07-24 12:17:47 -06:00
parent 77160434e6
commit f99de19792
10 changed files with 30 additions and 39 deletions

View File

@@ -124,9 +124,12 @@ module.exports = class User {
return isMember;
}
realName() {
return this.getProperty(UserProps.RealName) || this.username;
}
getSanitizedName(type = 'username') {
const name =
'real' === type ? this.getProperty(UserProps.RealName) : this.username;
const name = 'real' === type ? this.realName() : this.username;
return sanatizeFilename(name) || `user${this.userId.toString()}`;
}