Skip to content

Commit

Permalink
Remove displayUsername and use only username (Trustroots#1064)
Browse files Browse the repository at this point in the history
  • Loading branch information
tg-x authored and simison committed May 25, 2019
1 parent aa73b12 commit de3ae30
Show file tree
Hide file tree
Showing 27 changed files with 4 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ exports.contactListByUser = function (req, res, next, listUserId) {
updated: '$user.updated',
displayName: '$user.displayName',
username: '$user.username',
displayUsername: '$user.displayUsername',
avatarSource: '$user.avatarSource',
avatarUploaded: '$user.avatarUploaded',
locationFrom: '$user.locationFrom',
Expand Down
1 change: 0 additions & 1 deletion modules/core/tests/server/core.server.config.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('Configuration Tests:', function () {
displayName: 'Full Name A',
email: 'user_a@example.com',
username: credentials.username,
displayUsername: credentials.username,
password: credentials.password,
provider: 'local'
};
Expand Down
2 changes: 1 addition & 1 deletion modules/messages/client/views/thread.client.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h4>
{{ thread.userTo.displayName }}
</h4>
<small class="text-muted">
@{{ thread.userTo.displayUsername || thread.userTo.username }}
@{{ thread.userTo.username }}
</small>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('Job: message unread', function () {
displayName: 'FullFrom NameFrom',
email: 'userfrom@test.com',
username: 'userfrom',
displayUsername: 'userfrom',
password: 'M3@n.jsI$Aw3$0m4',
provider: 'local'
};
Expand All @@ -68,7 +67,6 @@ describe('Job: message unread', function () {
displayName: 'FullTo NameTo',
email: 'userto@test.com',
username: 'userto',
displayUsername: 'userto',
password: 'M3@n.jsI$Aw3$0m4',
provider: 'local'
};
Expand Down Expand Up @@ -168,7 +166,6 @@ describe('Job: message unread', function () {
displayName: 'Full3 Name3',
email: 'user3@test.com',
username: 'user3',
displayUsername: 'user3',
password: 'M3@n.jsI$Aw3$0m4',
provider: 'local'
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ describe('Job: reactivate members with hosting offer status set to "no"', functi
displayName: 'Full Name',
email: 'test@test.com',
username: 'jobtester',
displayUsername: 'jobtester',
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local'
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h4>Languages</h4>
<h4>
{{ ::search.offer.user.displayName }}
<small class="text-muted">
@{{ ::search.offer.user.displayUsername || search.offer.user.username }}
@{{ ::search.offer.user.username }}
</small>
</h4>
<div class="search-result-meta">
Expand Down
1 change: 0 additions & 1 deletion modules/tribes/tests/server/tribes.server.routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe('Tribe CRUD tests', function () {
displayName: 'Full Name',
email: 'test@test.com',
username: credentials.username,
displayUsername: credentials.username,
password: credentials.password,
provider: 'local',
public: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ng-bind="profileCtrl.profile.displayName"></h2>
<br>
<h4 class="profile-username">
@{{ profileCtrl.profile.displayUsername || profileCtrl.profile.username }}
@{{ profileCtrl.profile.username }}
</h4>
<br>
<p class="profile-tagline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ <h1>Don't panic!</h1>

<h4 class="text-muted profile-username"
ng-if="profileCtrl.profile.username">
@{{ profileCtrl.profile.displayUsername || profileCtrl.profile.username }}
@{{ profileCtrl.profile.username }}
</h4>

<a ui-sref="profile-edit.about"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ exports.signup = function (req, res) {
user.public = false;
user.provider = 'local';
user.displayName = user.firstName.trim() + ' ' + user.lastName.trim();
user.displayUsername = req.body.username;

// Just to simplify email confirm process later
// This field is normally needed when changing email after the signup process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ exports.userProfileFields = [
'id',
'displayName',
'username',
'displayUsername',
'gender',
'tagline',
'description',
Expand Down Expand Up @@ -77,7 +76,6 @@ exports.userMiniProfileFields = [
'updated', // Used as local-avatar cache buster
'displayName',
'username',
'displayUsername',
'avatarSource',
'avatarUploaded',
'emailHash',
Expand Down Expand Up @@ -324,7 +322,6 @@ exports.update = function (req, res) {
delete req.body.emailToken;
delete req.body.emailTemporary;
delete req.body.provider;
delete req.body.displayUsername;
delete req.body.usernameUpdated;
delete req.body.salt;
delete req.body.password;
Expand Down
6 changes: 0 additions & 6 deletions modules/users/server/models/user.server.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,6 @@ var UserSchema = new Schema({
usernameUpdated: {
type: Date
},
// Stores unaltered original username
displayUsername: {
type: String,
trim: true,
set: setPlainTextField
},
// Bewelcome.org username
extSitesBW: {
type: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('Job: user finish signup', function () {
emailTemporary: 'test@test.com', // unconfirmed users have this set
emailToken: 'initial email token',
username: 'user_unconfirmed',
displayUsername: 'user_unconfirmed',
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local',
created: moment().subtract(moment.duration({ 'hours': 4 }))
Expand All @@ -64,7 +63,6 @@ describe('Job: user finish signup', function () {
displayName: 'Full Name',
email: 'confirmed-test@test.com',
username: 'user_confirmed',
displayUsername: 'user_confirmed',
password: 'M3@n.jsI$Aw3$0m4',
provider: 'local',
created: moment().subtract(moment.duration({ 'hours': 4 }))
Expand Down Expand Up @@ -259,7 +257,6 @@ describe('Job: user finish signup', function () {
for (var i = 1; i <= config.limits.maxProcessSignupReminders + 1; i++) {
var loopVars = {
username: 'l' + i + _unConfirmedUser.username,
displayUsername: 'l' + i + _unConfirmedUser.displayUsername,
emailToken: 'l' + i + _unConfirmedUser.emailToken,
emailTemporary: 'l' + i + _unConfirmedUser.emailTemporary,
email: 'l' + i + _unConfirmedUser.email
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('Job: welcome sequence, first email', function () {
emailTemporary: 'test@test.com', // unconfirmed users have this set
emailToken: 'initial email token',
username: 'user_unconfirmed',
displayUsername: 'user_unconfirmed',
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local',
welcomeSequenceStep: 0,
Expand All @@ -80,7 +79,6 @@ describe('Job: welcome sequence, first email', function () {
displayName: 'Full Name',
email: 'confirmed-test@test.com',
username: 'user_confirmed',
displayUsername: 'user_confirmed',
password: 'M3@n.jsI$Aw3$0m4',
provider: 'local',
welcomeSequenceStep: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ describe('Job: welcome sequence, second email', function () {
emailTemporary: 'test@test.com', // unconfirmed users have this set
emailToken: 'initial email token',
username: 'user_unconfirmed',
displayUsername: 'user_unconfirmed',
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local',
welcomeSequenceStep: 0,
Expand All @@ -82,7 +81,6 @@ describe('Job: welcome sequence, second email', function () {
displayName: 'Full Name',
email: 'confirmed-test@test.com',
username: 'user_confirmed',
displayUsername: 'user_confirmed',
password: 'M3@n.jsI$Aw3$0m4',
provider: 'local',
welcomeSequenceStep: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ describe('Job: welcome sequence, third email', function () {
emailTemporary: 'test@test.com', // unconfirmed users have this set
emailToken: 'initial email token',
username: 'user_unconfirmed',
displayUsername: 'user_unconfirmed',
password: 'M3@n.jsI$Aw3$0m3',
provider: 'local',
welcomeSequenceStep: 0,
Expand All @@ -82,7 +81,6 @@ describe('Job: welcome sequence, third email', function () {
displayName: 'Full Name',
email: 'confirmed-test@test.com',
username: 'user_confirmed',
displayUsername: 'user_confirmed',
password: 'M3@n.jsI$Aw3$0m4',
provider: 'local',
welcomeSequenceStep: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('Search users: GET /users?search=string', function () {
get displayName() { return this.firstName + ' ' + this.lastName; },
get emailTemporary() { return this.email; },
emailToken: 'initial email token',
get displayUsername() { return this.username; },
password: user.password || '******password',
provider: 'local',
public: _.has(user, 'public') ? user.public : true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('User invites CRUD tests', function () {
displayName: 'Full Name',
email: 'test@example.org',
username: credentials.username.toLowerCase(),
displayUsername: credentials.username,
password: credentials.password,
provider: 'local',
public: true
Expand Down
1 change: 0 additions & 1 deletion modules/users/tests/server/user-lastseen.server.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe('User last seen CRUD tests', function () {
displayName: 'Full Name',
email: 'confirmed-test@test.com',
username: 'usertest',
displayUsername: 'usertest',
password: 'aPassWoRd_*....',
provider: 'local'
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe('User password CRUD tests', function () {
email: 'test@example.org',
emailToken: 'initial email token',
username: credentials.username.toLowerCase(),
displayUsername: credentials.username,
password: credentials.password,
provider: 'local'
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ describe('User profile CRUD tests', function () {
displayName: 'Full Name',
email: 'test@example.org',
username: credentials.username.toLowerCase(),
displayUsername: credentials.username,
password: credentials.password,
provider: 'local'
};
Expand All @@ -77,7 +76,6 @@ describe('User profile CRUD tests', function () {
emailTemporary: 'unconfirmed-test@example.org', // unconfirmed users have this set
emailToken: 'initial email token',
username: unConfirmedCredentials.username.toLowerCase(),
displayUsername: unConfirmedCredentials.username,
password: unConfirmedCredentials.password,
provider: 'local'
};
Expand Down Expand Up @@ -108,7 +106,6 @@ describe('User profile CRUD tests', function () {

res.body.should.be.instanceof(Object);
res.body.username.should.equal(unConfirmedUser.username);
res.body.displayUsername.should.equal(unConfirmedUser.displayUsername);
res.body.public.should.equal(false); // Unpublic right after signup
res.body.avatarSource.should.equal('gravatar'); // Defaults to `gravatar`
should.exist(res.body.languages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ describe('User removal CRUD tests', function () {
displayName: 'Full Name A',
email: 'user_a@example.com',
username: credentialsA.username.toLowerCase(),
displayUsername: credentialsA.username,
password: credentialsA.password,
provider: 'local'
};
Expand Down Expand Up @@ -97,7 +96,6 @@ describe('User removal CRUD tests', function () {
displayName: 'Full Name B',
email: 'user_b@example.com',
username: credentialsB.username.toLowerCase(),
displayUsername: credentialsB.username,
password: credentialsB.password,
provider: 'local'
};
Expand Down Expand Up @@ -752,7 +750,6 @@ describe('User removal CRUD tests', function () {
displayName: 'Full Name C',
email: 'user_c@example.com',
username: 'userc',
displayUsername: 'userc',
password: '**********asdfasdf',
provider: 'local'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe('User signup validation CRUD tests', function () {
email: 'test@example.org',
emailToken: 'initial email token',
username: 'taken_username',
displayUsername: 'taken_username',
password: 'TR-I$Aw3$0m4',
provider: 'local'
});
Expand Down
3 changes: 0 additions & 3 deletions modules/users/tests/server/user-signup.server.routes.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ describe('User signup and authentication CRUD tests', function () {
email: 'test@example.org',
emailToken: 'initial email token',
username: confirmedCredentials.username.toLowerCase(),
displayUsername: confirmedCredentials.username,
password: confirmedCredentials.password,
provider: 'local'
};
Expand All @@ -80,7 +79,6 @@ describe('User signup and authentication CRUD tests', function () {
emailTemporary: 'unconfirmed-test@example.org', // unconfirmed users have this set
emailToken: 'initial email token',
username: unConfirmedCredentials.username.toLowerCase(),
displayUsername: unConfirmedCredentials.username,
password: unConfirmedCredentials.password,
provider: 'local',
acquisitionStory: 'A fish told me...'
Expand All @@ -107,7 +105,6 @@ describe('User signup and authentication CRUD tests', function () {
}
signupRes.body.username.should.equal(_unConfirmedUser.username.toLowerCase());
signupRes.body.username.should.not.equal(_unConfirmedUser.username);
signupRes.body.displayUsername.should.equal(_unConfirmedUser.username);
signupRes.body.email.should.equal(_unConfirmedUser.email);
signupRes.body.emailTemporary.should.equal(_unConfirmedUser.email);
signupRes.body.provider.should.equal('local');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('User tribe memberships CRUD tests', function () {
email: 'test@example.org',
emailToken: 'initial email token',
username: credentials.username.toLowerCase(),
displayUsername: credentials.username,
password: credentials.password,
provider: 'local'
};
Expand Down
1 change: 0 additions & 1 deletion scripts/mass-email/loadData.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ async.eachSeries(
const user = _.extend(
_.pick(doc, [
"displayName",
"displayUsername",
"email",
"firstName",
"lastName",
Expand Down
1 change: 0 additions & 1 deletion testutils/data.server.testutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ function generateUsers(count, { username='username', firstName='GivenName', last
lastName: lastName + i,
email: i + email,
username: username + i,
displayUsername: username + i,
locale,
roles,
password: password || crypto.randomBytes(24).toString('base64')
Expand Down

0 comments on commit de3ae30

Please sign in to comment.