From 0d9e4bbf45ba2c676b403060e2f0da2bd8dcd7c8 Mon Sep 17 00:00:00 2001 From: Maxim Shishmarev Date: Fri, 13 Sep 2019 11:09:33 +1000 Subject: [PATCH] Only shorten pubkeys if name is present --- stylesheets/_modules.scss | 4 ++++ ts/components/conversation/ContactName.tsx | 4 +++- ts/components/conversation/Message.tsx | 18 ++++++++++++++---- ts/components/conversation/Quote.tsx | 1 + 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 7e9cd9895..332f276e4 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -20,6 +20,10 @@ font-style: italic; } +.module-contact-name.compact { + display: block; +} + // Module: Message .module-message { diff --git a/ts/components/conversation/ContactName.tsx b/ts/components/conversation/ContactName.tsx index 6f9a4998e..39f69d4c9 100644 --- a/ts/components/conversation/ContactName.tsx +++ b/ts/components/conversation/ContactName.tsx @@ -11,6 +11,7 @@ interface Props { i18n: LocalizerType; module?: string; boldProfileName?: Boolean; + compact?: Boolean; } export class ContactName extends React.Component { @@ -22,6 +23,7 @@ export class ContactName extends React.Component { i18n, module, boldProfileName, + compact, } = this.props; const prefix = module ? module : 'module-contact-name'; @@ -39,7 +41,7 @@ export class ContactName extends React.Component { ) : null; return ( - + {profileElement} {shouldShowProfile ? ' ' : null} { return null; } + const shortenedPubkey = `(...${authorPhoneNumber.substring( + authorPhoneNumber.length - 6 + )})`; + + const displayedPubkey = authorProfileName + ? shortenedPubkey + : authorPhoneNumber; + return (
{ quote.authorPhoneNumber.length - 6 )})`; + const displayedPubkey = quote.authorProfileName + ? shortenedPubkey + : quote.authorPhoneNumber; + return ( { text={quote.text} attachment={quote.attachment} isIncoming={direction === 'incoming'} - authorPhoneNumber={shortenedPubkey} + authorPhoneNumber={displayedPubkey} authorProfileName={quote.authorProfileName} authorName={quote.authorName} authorColor={quoteColor} diff --git a/ts/components/conversation/Quote.tsx b/ts/components/conversation/Quote.tsx index 8caebbf4e..266ae808f 100644 --- a/ts/components/conversation/Quote.tsx +++ b/ts/components/conversation/Quote.tsx @@ -304,6 +304,7 @@ export class Quote extends React.Component { name={authorName} profileName={authorProfileName} i18n={i18n} + compact={true} /> )}