From c306f553a4c504f7e43e537dca1de20674d7c55f Mon Sep 17 00:00:00 2001 From: EthanBlackburn Date: Tue, 7 Jul 2015 12:08:59 -0700 Subject: [PATCH] Contact first names now set to the first non-article word Summary: Fixes T2179. This fixes the weird bug where first names like "The Nylas Team" was shortened to "The". The fix just chooses the first non-article word as the first name Test Plan: tested manually Reviewers: bengotow Reviewed By: bengotow Subscribers: jennie Maniphest Tasks: T2179 Differential Revision: https://phab.nylas.com/D1715 --- src/flux/models/contact.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/flux/models/contact.coffee b/src/flux/models/contact.coffee index 827cb6ace..4dbde8c85 100644 --- a/src/flux/models/contact.coffee +++ b/src/flux/models/contact.coffee @@ -79,7 +79,11 @@ class Contact extends Model @lastName() firstName: -> - @_nameParts()[0] ? "" + articles = ['a', 'the'] + for part in @_nameParts() + if part.toLowerCase() not in articles + return part + return "" lastName: -> @_nameParts()[1..-1]?.join(" ") ? ""