From b2e880080e91b36708ccff8c3339123a7c8f37c1 Mon Sep 17 00:00:00 2001 From: NB Date: Fri, 5 Jan 2018 10:26:08 -0500 Subject: [PATCH] Add an option to enable reverse name parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds a preference option for to enable/disable reverse name parsing. The default is set to `true`. If the user disables (changes to `false`) this from Preferences > General > Reading, NML wouldn’t attempt reverse name parsing. --- packages/client-app/src/config-schema.es6 | 5 +++++ packages/client-app/src/flux/models/contact.es6 | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/packages/client-app/src/config-schema.es6 b/packages/client-app/src/config-schema.es6 index 039643c5f..f026842df 100644 --- a/packages/client-app/src/config-schema.es6 +++ b/packages/client-app/src/config-schema.es6 @@ -99,6 +99,11 @@ export default { 'default': false, 'title': "Display conversations in descending chronological order", }, + lastNameFirstNameParsing: { + 'type': 'boolean', + 'default': true, + 'title': "Automatically parse names that are in the 'Last Name, First Name' format" + }, }, }, composing: { diff --git a/packages/client-app/src/flux/models/contact.es6 b/packages/client-app/src/flux/models/contact.es6 index 9bc16e698..972d1b3b5 100644 --- a/packages/client-app/src/flux/models/contact.es6 +++ b/packages/client-app/src/flux/models/contact.es6 @@ -301,6 +301,12 @@ export default class Contact extends Model { } _parseReverseNames(name) { + // If the user doesn't want to parse Reverse Names, simply return an empty array + // Fixed https://github.com/nylas-mail-lives/nylas-mail/issues/179 + if( !NylasEnv.config.get('core.reading.lastNameFirstNameParsing') ) { + return []; + } + const parts = []; const [lastName, remainder] = name.split(', '); if (remainder) {