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
This commit is contained in:
EthanBlackburn 2015-07-07 12:08:59 -07:00
parent 343bb3163b
commit 9df066808b

View file

@ -79,7 +79,11 @@ class Contact extends Model
@lastName() @lastName()
firstName: -> firstName: ->
@_nameParts()[0] ? "" articles = ['a', 'the']
for part in @_nameParts()
if part.toLowerCase() not in articles
return part
return ""
lastName: -> lastName: ->
@_nameParts()[1..-1]?.join(" ") ? "" @_nameParts()[1..-1]?.join(" ") ? ""