remove fake names from profile

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-05-06 09:20:45 +02:00
parent 2e2ee1422f
commit fc0a6a3c73
8 changed files with 55 additions and 41 deletions

View File

@@ -1,6 +1,15 @@
import type { IServiceProfile } from '@openpanel/db';
export function getProfileName(profile: IServiceProfile | undefined | null) {
if (!profile) return 'No name';
return [profile.firstName, profile.lastName].filter(Boolean).join(' ');
if (!profile) return 'Unknown';
if (!profile.isExternal) {
return profile.id;
}
return (
[profile.firstName, profile.lastName].filter(Boolean).join(' ') ||
profile.email ||
profile.id
);
}