mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 08:19:07 +00:00
Change audit logs endpoints to return just the fullname and not all the user info
This commit is contained in:
parent
477cd21eba
commit
b90589d9a2
@ -192,7 +192,7 @@ describe('Audit logs service', () => {
|
||||
populate: ['user'],
|
||||
fields: ['action', 'date', 'payload'],
|
||||
});
|
||||
expect(result).toEqual({ id: 1, user: null });
|
||||
expect(result).toEqual({ id: 1, fullname: null });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const localProvider = require('@strapi/provider-audit-logs-local');
|
||||
const { getService } = require('../../../server/utils');
|
||||
|
||||
const defaultEvents = [
|
||||
'entry.create',
|
||||
@ -83,7 +82,7 @@ const createAuditLogsService = (strapi) => {
|
||||
const { user, ...rest } = result;
|
||||
return {
|
||||
...rest,
|
||||
user: user ? getService('user').sanitizeUser(user) : null,
|
||||
fullname: user ? `${user.firstname} ${user.lastname}` : null,
|
||||
};
|
||||
});
|
||||
|
||||
@ -103,7 +102,7 @@ const createAuditLogsService = (strapi) => {
|
||||
const { user, ...rest } = result;
|
||||
return {
|
||||
...rest,
|
||||
user: user ? getService('user').sanitizeUser(user) : null,
|
||||
fullname: user ? `${user.firstname} ${user.lastname}` : null,
|
||||
};
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user