Fix that returns an empty object when the admin user value is null

Signed-off-by: harimkims <harimkims@gmail.com>
This commit is contained in:
harimkims 2021-12-27 01:52:54 +09:00 committed by Pierre Noël
parent 2ff2ba860e
commit de69873606

View File

@ -108,7 +108,7 @@ module.exports = ({ action, ability, model }) => {
const omitCreatorRoles = omit([`${CREATED_BY_ATTRIBUTE}.roles`, `${UPDATED_BY_ATTRIBUTE}.roles`]);
const pickAllowedAdminUserFields = ({ attribute, key, value }, { set }) => {
if (attribute.type === 'relation' && attribute.target === 'admin::user') {
if (attribute.type === 'relation' && attribute.target === 'admin::user' && value) {
if (Array.isArray(value)) {
set(key, value.map(val => pick(['id', 'firstname', 'lastname', 'username'], val)), value);
} else {