From a481bcf3d7995e19bf25fbfdac2794ff6cb0e9a1 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Fri, 5 Feb 2021 20:56:26 +0100 Subject: [PATCH] Fix display name with empty last name Signed-off-by: Lorenz Stechauner --- src/models/contact.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/models/contact.js b/src/models/contact.js index ea128db2a..f132038c2 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -404,11 +404,17 @@ export default class Contact { case 'firstName': // Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P. // -> John Stevenson + if (isEmpty(n[0])) { + return n[1] + } return n.slice(0, 2).reverse().join(' ') case 'lastName': // Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P. // -> Stevenson, John + if (isEmpty(n[0])) { + return n[1] + } return n.slice(0, 2).join(', ') } } @@ -420,6 +426,9 @@ export default class Contact { if (n && !isEmpty(n)) { // Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P. // -> John Stevenson + if (isEmpty(n[0])) { + return n[1] + } return n.slice(0, 2).reverse().join(' ') } // LAST chance, use the org ir that's the only thing we have