Make real name and other properties optional - pass 1
This commit is contained in:
parent
77160434e6
commit
f99de19792
|
@ -505,7 +505,7 @@ class Achievements {
|
||||||
getFormatObject(info) {
|
getFormatObject(info) {
|
||||||
return {
|
return {
|
||||||
userName: info.user.username,
|
userName: info.user.username,
|
||||||
userRealName: info.user.properties[UserProps.RealName],
|
userRealName: info.user.realName(),
|
||||||
userLocation: info.user.properties[UserProps.Location],
|
userLocation: info.user.properties[UserProps.Location],
|
||||||
userAffils: info.user.properties[UserProps.Affiliations],
|
userAffils: info.user.properties[UserProps.Affiliations],
|
||||||
nodeId: info.client.node,
|
nodeId: info.client.node,
|
||||||
|
|
|
@ -87,7 +87,7 @@ function getActiveConnectionList(
|
||||||
//
|
//
|
||||||
entry.text = ac.user?.username || 'N/A';
|
entry.text = ac.user?.username || 'N/A';
|
||||||
entry.userName = ac.user?.username || 'N/A';
|
entry.userName = ac.user?.username || 'N/A';
|
||||||
entry.realName = ac.user?.getProperty(UserProps.RealName) || 'N/A';
|
entry.realName = ac.user?.realName() || 'N/A';
|
||||||
entry.location = ac.user?.getProperty(UserProps.Location) || 'N/A';
|
entry.location = ac.user?.getProperty(UserProps.Location) || 'N/A';
|
||||||
entry.affils = entry.affiliation =
|
entry.affils = entry.affiliation =
|
||||||
ac.user?.getProperty(UserProps.Affiliations) || 'N/A';
|
ac.user?.getProperty(UserProps.Affiliations) || 'N/A';
|
||||||
|
|
|
@ -982,11 +982,7 @@ exports.FullScreenEditorModule =
|
||||||
const area = getMessageAreaByTag(self.messageAreaTag);
|
const area = getMessageAreaByTag(self.messageAreaTag);
|
||||||
if (fromView !== undefined) {
|
if (fromView !== undefined) {
|
||||||
if (area && area.realNames) {
|
if (area && area.realNames) {
|
||||||
fromView.setText(
|
fromView.setText(self.client.user.realName());
|
||||||
self.client.user.properties[
|
|
||||||
UserProps.RealName
|
|
||||||
] || self.client.user.username
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
fromView.setText(self.client.user.username);
|
fromView.setText(self.client.user.username);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,7 @@ exports.getModule = class MyMessagesModule extends MenuModule {
|
||||||
|
|
||||||
initSequence() {
|
initSequence() {
|
||||||
const filter = {
|
const filter = {
|
||||||
toUserName: [
|
toUserName: [this.client.user.username, this.client.user.realName()],
|
||||||
this.client.user.username,
|
|
||||||
this.client.user.getProperty(UserProps.RealName),
|
|
||||||
],
|
|
||||||
sort: 'modTimestamp',
|
sort: 'modTimestamp',
|
||||||
resultType: 'messageList',
|
resultType: 'messageList',
|
||||||
limit: 1024 * 16, // we want some sort of limit...
|
limit: 1024 * 16, // we want some sort of limit...
|
||||||
|
|
15
core/nua.js
15
core/nua.js
|
@ -13,6 +13,7 @@ const UserProps = require('./user_property.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
const moment = require('moment');
|
||||||
|
|
||||||
exports.moduleInfo = {
|
exports.moduleInfo = {
|
||||||
name: 'NUA',
|
name: 'NUA',
|
||||||
|
@ -95,15 +96,15 @@ exports.getModule = class NewUserAppModule extends MenuModule {
|
||||||
areaTag = areaTag || '';
|
areaTag = areaTag || '';
|
||||||
|
|
||||||
newUser.properties = {
|
newUser.properties = {
|
||||||
[UserProps.RealName]: formData.value.realName,
|
[UserProps.RealName]: formData.value.realName || '',
|
||||||
[UserProps.Birthdate]: getISOTimestampString(
|
[UserProps.Birthdate]: getISOTimestampString(
|
||||||
formData.value.birthdate
|
formData.value.birthdate || moment()
|
||||||
),
|
),
|
||||||
[UserProps.Sex]: formData.value.sex,
|
[UserProps.Sex]: formData.value.sex || '',
|
||||||
[UserProps.Location]: formData.value.location,
|
[UserProps.Location]: formData.value.location || '',
|
||||||
[UserProps.Affiliations]: formData.value.affils,
|
[UserProps.Affiliations]: formData.value.affils || '',
|
||||||
[UserProps.EmailAddress]: formData.value.email,
|
[UserProps.EmailAddress]: formData.value.email || '',
|
||||||
[UserProps.WebAddress]: formData.value.web,
|
[UserProps.WebAddress]: formData.value.web || '',
|
||||||
[UserProps.AccountCreated]: getISOTimestampString(),
|
[UserProps.AccountCreated]: getISOTimestampString(),
|
||||||
|
|
||||||
[UserProps.MessageConfTag]: confTag,
|
[UserProps.MessageConfTag]: confTag,
|
||||||
|
|
|
@ -124,9 +124,12 @@ module.exports = class User {
|
||||||
return isMember;
|
return isMember;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
realName() {
|
||||||
|
return this.getProperty(UserProps.RealName) || this.username;
|
||||||
|
}
|
||||||
|
|
||||||
getSanitizedName(type = 'username') {
|
getSanitizedName(type = 'username') {
|
||||||
const name =
|
const name = 'real' === type ? this.realName() : this.username;
|
||||||
'real' === type ? this.getProperty(UserProps.RealName) : this.username;
|
|
||||||
return sanatizeFilename(name) || `user${this.userId.toString()}`;
|
return sanatizeFilename(name) || `user${this.userId.toString()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,9 +93,9 @@ module.exports = class User2FA_OTPWebRegister {
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
to: `${
|
to: `${user.realName()} <${user.getProperty(
|
||||||
user.getProperty(UserProps.RealName) || user.username
|
UserProps.EmailAddress
|
||||||
} <${user.getProperty(UserProps.EmailAddress)}>`,
|
)}>`,
|
||||||
// from will be filled in
|
// from will be filled in
|
||||||
subject: '2-Factor Authentication Registration',
|
subject: '2-Factor Authentication Registration',
|
||||||
text: textTemplate,
|
text: textTemplate,
|
||||||
|
|
|
@ -115,15 +115,15 @@ exports.getModule = class UserConfigModule extends MenuModule {
|
||||||
formData = _.clone(formData);
|
formData = _.clone(formData);
|
||||||
|
|
||||||
const newProperties = {
|
const newProperties = {
|
||||||
[UserProps.RealName]: formData.value.realName,
|
[UserProps.RealName]: formData.value.realName || '',
|
||||||
[UserProps.Birthdate]: getISOTimestampString(
|
[UserProps.Birthdate]: getISOTimestampString(
|
||||||
formData.value.birthdate
|
formData.value.birthdate || moment()
|
||||||
),
|
),
|
||||||
[UserProps.Sex]: formData.value.sex,
|
[UserProps.Sex]: formData.value.sex || '',
|
||||||
[UserProps.Location]: formData.value.location,
|
[UserProps.Location]: formData.value.location || '',
|
||||||
[UserProps.Affiliations]: formData.value.affils,
|
[UserProps.Affiliations]: formData.value.affils || '',
|
||||||
[UserProps.EmailAddress]: formData.value.email,
|
[UserProps.EmailAddress]: formData.value.email || '',
|
||||||
[UserProps.WebAddress]: formData.value.web,
|
[UserProps.WebAddress]: formData.value.web || '',
|
||||||
[UserProps.TermHeight]: formData.value.termHeight.toString(),
|
[UserProps.TermHeight]: formData.value.termHeight.toString(),
|
||||||
[UserProps.ThemeId]:
|
[UserProps.ThemeId]:
|
||||||
self.availThemeInfo[formData.value.theme].themeId,
|
self.availThemeInfo[formData.value.theme].themeId,
|
||||||
|
@ -233,11 +233,7 @@ exports.getModule = class UserConfigModule extends MenuModule {
|
||||||
function populateViews(callback) {
|
function populateViews(callback) {
|
||||||
const user = self.client.user;
|
const user = self.client.user;
|
||||||
|
|
||||||
self.setViewText(
|
self.setViewText('menu', MciCodeIds.RealName, user.realName());
|
||||||
'menu',
|
|
||||||
MciCodeIds.RealName,
|
|
||||||
user.properties[UserProps.RealName]
|
|
||||||
);
|
|
||||||
self.setViewText(
|
self.setViewText(
|
||||||
'menu',
|
'menu',
|
||||||
MciCodeIds.BirthDate,
|
MciCodeIds.BirthDate,
|
||||||
|
|
|
@ -143,7 +143,7 @@ class WebPasswordReset {
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
to: `${user.properties[UserProps.RealName] || user.username} <${
|
to: `${user.realName()} <${
|
||||||
user.properties[UserProps.EmailAddress]
|
user.properties[UserProps.EmailAddress]
|
||||||
}>`,
|
}>`,
|
||||||
// from will be filled in
|
// from will be filled in
|
||||||
|
|
|
@ -506,9 +506,7 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
||||||
|
|
||||||
// Current
|
// Current
|
||||||
currentUserName: this.client.user.username,
|
currentUserName: this.client.user.username,
|
||||||
currentUserRealName:
|
currentUserRealName: this.client.user.realName(),
|
||||||
this.client.user.getProperty(UserProps.RealName) ||
|
|
||||||
this.client.user.username,
|
|
||||||
availIndicator: availIndicator,
|
availIndicator: availIndicator,
|
||||||
visIndicator: visIndicator,
|
visIndicator: visIndicator,
|
||||||
lastLoginUserName: lastLoginStats.userName,
|
lastLoginUserName: lastLoginStats.userName,
|
||||||
|
|
Loading…
Reference in New Issue