Always add *_by_name fields along with *_by fields
This commit is contained in:
parent
84bc84e7c1
commit
2abed2ed57
1 changed files with 2 additions and 4 deletions
|
|
@ -187,14 +187,12 @@ function format (customer) {
|
||||||
*/
|
*/
|
||||||
function populateOverrideUsernames (customer) {
|
function populateOverrideUsernames (customer) {
|
||||||
return Promise.all(_.map(field => {
|
return Promise.all(_.map(field => {
|
||||||
if (customer[field + '_override_by']) {
|
|
||||||
return users.get(customer[field + '_override_by'])
|
return users.get(customer[field + '_override_by'])
|
||||||
.then(user => {
|
.then(user => {
|
||||||
// just add the name to the customer object
|
// just add the name to the customer object
|
||||||
customer[field + '_override_by_name'] = user.name
|
customer[field + '_override_by_name'] = (user) ? user.name : null
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
} else return null
|
|
||||||
}, getComplianceTypes()))
|
}, getComplianceTypes()))
|
||||||
.then(() => customer)
|
.then(() => customer)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue