Merge pull request #503 from msgmaxim/shorten_pubkey

Shorten pubkeys in quotations too
pull/508/head
Mikunj Varsani 6 years ago committed by GitHub
commit 69eab9f196
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,6 +20,10 @@
font-style: italic; font-style: italic;
} }
.module-contact-name.compact {
display: block;
}
// Module: Message // Module: Message
.module-message { .module-message {

@ -11,6 +11,7 @@ interface Props {
i18n: LocalizerType; i18n: LocalizerType;
module?: string; module?: string;
boldProfileName?: Boolean; boldProfileName?: Boolean;
compact?: Boolean;
} }
export class ContactName extends React.Component<Props> { export class ContactName extends React.Component<Props> {
@ -22,6 +23,7 @@ export class ContactName extends React.Component<Props> {
i18n, i18n,
module, module,
boldProfileName, boldProfileName,
compact,
} = this.props; } = this.props;
const prefix = module ? module : 'module-contact-name'; const prefix = module ? module : 'module-contact-name';
@ -39,7 +41,7 @@ export class ContactName extends React.Component<Props> {
) : null; ) : null;
return ( return (
<span className={prefix} dir="auto"> <span className={classNames(prefix, compact && 'compact')} dir="auto">
{profileElement} {profileElement}
{shouldShowProfile ? ' ' : null} {shouldShowProfile ? ' ' : null}
<span <span

@ -322,12 +322,18 @@ export class Message extends React.PureComponent<Props, State> {
return null; return null;
} }
const shortenedPubkey = `(...${authorPhoneNumber.substring(
authorPhoneNumber.length - 6
)})`;
const displayedPubkey = authorProfileName
? shortenedPubkey
: authorPhoneNumber;
return ( return (
<div className="module-message__author"> <div className="module-message__author">
<ContactName <ContactName
phoneNumber={`(...${authorPhoneNumber.substring( phoneNumber={displayedPubkey}
authorPhoneNumber.length - 6
)})`}
name={authorName} name={authorName}
profileName={authorProfileName} profileName={authorProfileName}
module="module-message__author" module="module-message__author"
@ -590,6 +596,14 @@ export class Message extends React.PureComponent<Props, State> {
const quoteColor = const quoteColor =
direction === 'incoming' ? authorColor : quote.authorColor; direction === 'incoming' ? authorColor : quote.authorColor;
const shortenedPubkey = `(...${quote.authorPhoneNumber.substring(
quote.authorPhoneNumber.length - 6
)})`;
const displayedPubkey = quote.authorProfileName
? shortenedPubkey
: quote.authorPhoneNumber;
return ( return (
<Quote <Quote
i18n={i18n} i18n={i18n}
@ -597,7 +611,7 @@ export class Message extends React.PureComponent<Props, State> {
text={quote.text} text={quote.text}
attachment={quote.attachment} attachment={quote.attachment}
isIncoming={direction === 'incoming'} isIncoming={direction === 'incoming'}
authorPhoneNumber={quote.authorPhoneNumber} authorPhoneNumber={displayedPubkey}
authorProfileName={quote.authorProfileName} authorProfileName={quote.authorProfileName}
authorName={quote.authorName} authorName={quote.authorName}
authorColor={quoteColor} authorColor={quoteColor}

@ -304,6 +304,7 @@ export class Quote extends React.Component<Props, State> {
name={authorName} name={authorName}
profileName={authorProfileName} profileName={authorProfileName}
i18n={i18n} i18n={i18n}
compact={true}
/> />
)} )}
</div> </div>

Loading…
Cancel
Save