add missing awaits for eventlog.add

This commit is contained in:
Girish Ramakrishnan
2022-02-24 20:04:46 -08:00
parent 9a6694286a
commit a3e097d541
10 changed files with 28 additions and 28 deletions

View File

@@ -253,7 +253,7 @@ async function add(email, data, auditSource) {
if (!auditSource.userId) auditSource.userId = user.id;
if (!auditSource.username) auditSource.username= user.username;
eventlog.add(eventlog.ACTION_USER_ADD, auditSource, { userId: user.id, email: user.email, user: removePrivateFields(user) });
await eventlog.add(eventlog.ACTION_USER_ADD, auditSource, { userId: user.id, email: user.email, user: removePrivateFields(user) });
return user.id;
}
@@ -405,7 +405,7 @@ async function del(user, auditSource) {
if (error) throw error;
if (result[3].affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'User not found');
await safe(eventlog.add(eventlog.ACTION_USER_REMOVE, auditSource, { userId: user.id, user: removePrivateFields(user) }));
await eventlog.add(eventlog.ACTION_USER_REMOVE, auditSource, { userId: user.id, user: removePrivateFields(user) });
}
async function list() {
@@ -600,7 +600,7 @@ async function update(user, data, auditSource) {
const newUser = _.extend({}, user, data);
eventlog.add(eventlog.ACTION_USER_UPDATE, auditSource, {
await eventlog.add(eventlog.ACTION_USER_UPDATE, auditSource, {
userId: user.id,
user: removePrivateFields(newUser),
roleChanged: newUser.role !== user.role,