* fix issue #2134 * username is returned only when generated * fix unit tests * incorporate @flovilmart review
This commit is contained in:
committed by
Florent Vilmart
parent
2a4fbf7a15
commit
a861c4e506
@@ -351,6 +351,7 @@ RestWrite.prototype.transformUser = function() {
|
||||
if (!this.data.username) {
|
||||
if (!this.query) {
|
||||
this.data.username = cryptoUtils.randomString(25);
|
||||
this.responseShouldHaveUsername = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -790,6 +791,10 @@ RestWrite.prototype.runDatabaseOperation = function() {
|
||||
.then(response => {
|
||||
response.objectId = this.data.objectId;
|
||||
response.createdAt = this.data.createdAt;
|
||||
|
||||
if (this.responseShouldHaveUsername) {
|
||||
response.username = this.data.username;
|
||||
}
|
||||
if (this.storage.changedByTrigger) {
|
||||
Object.keys(this.data).forEach(fieldName => {
|
||||
response[fieldName] = response[fieldName] || this.data[fieldName];
|
||||
|
||||
Reference in New Issue
Block a user