From 5a8a6382e289a64040535b60757a9ee1fc2122a3 Mon Sep 17 00:00:00 2001 From: John McNair Date: Thu, 21 Apr 2016 00:52:21 -0400 Subject: [PATCH 1/2] Added config option to use long contact names Useful when your contact list has a lot of overlapping first names. I was selective in applying this. For instance, it made sense to leave the behavior as is in the thread list for conversations with multiple messages. This option (when selected) causes long names to be used when: - viewing the message list for a given conversation - viewing the expanded or collapsed headers for a selected message The default behavior is not to have this option selected which preserves previous functionality. Also the "isMe" detection still works sensibly even when this option is selected. --- internal_packages/message-list/lib/message-item.cjsx | 3 ++- internal_packages/message-list/lib/message-participants.cjsx | 3 ++- src/config-schema.coffee | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/internal_packages/message-list/lib/message-item.cjsx b/internal_packages/message-list/lib/message-item.cjsx index d971d5b72e..b10bc817a3 100644 --- a/internal_packages/message-list/lib/message-item.cjsx +++ b/internal_packages/message-list/lib/message-item.cjsx @@ -54,6 +54,7 @@ class MessageItem extends React.Component _renderCollapsed: => attachmentIcon = [] + isCompact = not NylasEnv.config.get('core.reading.useLongDisplayNames') if Utils.showIconForAttachments(@props.message.files) attachmentIcon =
@@ -61,7 +62,7 @@ class MessageItem extends React.Component
- {@props.message.from?[0]?.displayName(compact: true)} + {@props.message.from?[0]?.displayName(compact: isCompact)}
{@props.message.snippet} diff --git a/internal_packages/message-list/lib/message-participants.cjsx b/internal_packages/message-list/lib/message-participants.cjsx index 4837de7a32..08d119c2a1 100644 --- a/internal_packages/message-list/lib/message-participants.cjsx +++ b/internal_packages/message-list/lib/message-participants.cjsx @@ -40,7 +40,8 @@ class MessageParticipants extends React.Component selection.addRange(range) _shortNames: (contacts = [], max = MAX_COLLAPSED) => - names = _.map(contacts, (c) -> c.displayName(includeAccountLabel: true, compact: true)) + isCompact = not NylasEnv.config.get('core.reading.useLongDisplayNames') + names = _.map(contacts, (c) -> c.displayName(includeAccountLabel: true, compact: isCompact)) if names.length > max extra = names.length - max names = names.slice(0, max) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 25a2faa099..3e5ed2edbb 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -66,6 +66,10 @@ module.exports = type: 'boolean' default: false title: "Swipe gesture and backspace / delete move messages to trash" + useLongDisplayNames: + type: 'boolean' + default: false + title: "Use full contact names instead of compact" sending: type: 'object' properties: From ae10ba761433fda47b4b94f9af9ba83d46b97a3e Mon Sep 17 00:00:00 2001 From: John McNair Date: Thu, 21 Apr 2016 01:06:34 -0400 Subject: [PATCH 2/2] Put a space between name and email --- internal_packages/message-list/lib/message-participants.cjsx | 2 +- .../message-list/spec/message-participants-spec.cjsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal_packages/message-list/lib/message-participants.cjsx b/internal_packages/message-list/lib/message-participants.cjsx index 08d119c2a1..20802e8056 100644 --- a/internal_packages/message-list/lib/message-participants.cjsx +++ b/internal_packages/message-list/lib/message-participants.cjsx @@ -62,7 +62,7 @@ class MessageParticipants extends React.Component {c.fullName()}
- {"<"}{c.email}{">#{comma}"} +  {"<"}{c.email}{">#{comma}"}
else diff --git a/internal_packages/message-list/spec/message-participants-spec.cjsx b/internal_packages/message-list/spec/message-participants-spec.cjsx index ad38159539..cd5f97634c 100644 --- a/internal_packages/message-list/spec/message-participants-spec.cjsx +++ b/internal_packages/message-list/spec/message-participants-spec.cjsx @@ -90,7 +90,7 @@ describe "MessageParticipants", -> it "uses full names", -> to = ReactTestUtils.findRenderedDOMComponentWithClass(@participants, "to-contact") - expect(ReactDOM.findDOMNode(to).innerText.trim()).toEqual "User Two" + expect(ReactDOM.findDOMNode(to).innerText.trim()).toEqual "User Two " # TODO: We no longer display "to everyone"