Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions backend/src/services/organizationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,11 @@ export default class OrganizationService extends LoggerBase {
if (existing) {
await OrganizationRepository.checkIdentities(data, this.options, existing.id)

// Set displayName if it doesn't exist
if (!existing.displayName) {
data.displayName = cache.name
}

record = await OrganizationRepository.update(
existing.id,
{ ...data, ...cache },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,12 @@ export default class OrganizationEnrichmentService extends LoggerBase {
}
}

// Set displayName using the first identity or fallback to website
if (!data.displayName) {
const identity = data.identities[0]
data.displayName = identity ? identity.name : data.website
}

return lodash.pick(
{ ...data, lastEnrichedAt: new Date() },
this.selectFieldsForEnrichment(instance),
Expand Down
1 change: 1 addition & 0 deletions services/libs/types/src/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { OrganizationSource } from './enums/organizations'

export interface IOrganization {
id?: string
displayName?: string
url?: string
description?: string
emails?: string[]
Expand Down