BlueBubblesApp / bluebubbles-server

Server for forwarding iMessages to clients within the BlueBubbles App ecosystem
https://bluebubbles.app
Apache License 2.0
554 stars 47 forks source link

[Contacts API] Don't use nickname as Display Name #458

Closed zlshames closed 1 year ago

zlshames commented 1 year ago

@tneotia looking at my code, the nickname is only used if there is no display name (for the display name field). Would you rather me add a nickname field and make the display name the first + last name?

tneotia commented 1 year ago

Yes I think that is a better move, not sure if we even need a nickname field. Can just ignore that

zlshames commented 1 year ago

Ok, here is my logic:

let displayName = null;
if (isNotEmpty(e?.firstName) && isEmpty(e?.lastName)) displayName = e.firstName;
if (isNotEmpty(e?.firstName) && isNotEmpty(e?.lastName)) displayName = `${e.firstName} ${e.lastName}`;
if (isEmpty(displayName) && isNotEmpty(e?.nickname)) displayName = e.nickname;

Basically, use the first & last name, and if that doesn't exist somehow, use the nickname

tneotia commented 1 year ago

yeah should be fine

zlshames commented 1 year ago

Fixed, dev branch