Merge pull request #1374 from Bilb/hide-shorten-pubkey-except-public

pull/1378/head
Audric Ackermann 5 years ago committed by GitHub
commit dfff6c2149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1028,7 +1028,7 @@
} }
.module-conversation-header__title { .module-conversation-header__title {
margin-inline-start: 6px; margin: 0px 20px;
min-width: 0; min-width: 0;
font-size: 16px; font-size: 16px;
@ -1046,6 +1046,12 @@
align-items: center; align-items: center;
-webkit-user-select: text; -webkit-user-select: text;
.module-contact-name__profile-name {
width: 100%;
overflow: hidden !important;
text-overflow: ellipsis;
}
} }
.module-conversation-header__title__profile-name { .module-conversation-header__title__profile-name {

@ -348,6 +348,11 @@ class ConversationListItem extends React.PureComponent<Props> {
const displayedPubkey = profileName ? shortenedPubkey : phoneNumber; const displayedPubkey = profileName ? shortenedPubkey : phoneNumber;
const displayName = isMe ? i18n('noteToSelf') : profileName; const displayName = isMe ? i18n('noteToSelf') : profileName;
let shouldShowPubkey = false;
if (!name || name.length === 0) {
shouldShowPubkey = true;
}
return ( return (
<div className="module-conversation__user"> <div className="module-conversation__user">
<ContactName <ContactName
@ -357,6 +362,7 @@ class ConversationListItem extends React.PureComponent<Props> {
module="module-conversation__user" module="module-conversation__user"
i18n={window.i18n} i18n={window.i18n}
boldProfileName={true} boldProfileName={true}
shouldShowPubkey={shouldShowPubkey}
/> />
</div> </div>
); );

@ -68,6 +68,7 @@ export class MessageSearchResult extends React.PureComponent<Props> {
profileName={from.profileName} profileName={from.profileName}
i18n={i18n} i18n={i18n}
module="module-message-search-result__header__name" module="module-message-search-result__header__name"
shouldShowPubkey={false}
/> />
); );
} }
@ -86,6 +87,7 @@ export class MessageSearchResult extends React.PureComponent<Props> {
name={to.name} name={to.name}
profileName={to.profileName} profileName={to.profileName}
i18n={i18n} i18n={i18n}
shouldShowPubkey={false}
/> />
</span> </span>
</div> </div>

@ -12,6 +12,7 @@ interface Props {
module?: string; module?: string;
boldProfileName?: Boolean; boldProfileName?: Boolean;
compact?: Boolean; compact?: Boolean;
shouldShowPubkey: Boolean;
} }
export class ContactName extends React.Component<Props> { export class ContactName extends React.Component<Props> {
@ -24,19 +25,27 @@ export class ContactName extends React.Component<Props> {
module, module,
boldProfileName, boldProfileName,
compact, compact,
shouldShowPubkey,
} = this.props; } = this.props;
const prefix = module ? module : 'module-contact-name'; const prefix = module ? module : 'module-contact-name';
const title = name ? name : phoneNumber; const title = name ? name : phoneNumber;
const shouldShowProfile = Boolean(profileName && !name); const shouldShowProfile = Boolean(profileName || name);
const styles = (boldProfileName const styles = (boldProfileName
? { ? {
fontWeight: 'bold', fontWeight: 'bold',
} }
: {}) as React.CSSProperties; : {}) as React.CSSProperties;
const textProfile = profileName || name || i18n('anonymous');
const profileElement = shouldShowProfile ? ( const profileElement = shouldShowProfile ? (
<span style={styles} className={`${prefix}__profile-name`}> <span style={styles} className={`${prefix}__profile-name`}>
<Emojify text={profileName || ''} i18n={i18n} /> <Emojify text={textProfile} i18n={i18n} />
</span>
) : null;
const pubKeyElement = shouldShowPubkey ? (
<span className={`${prefix}__profile-number`}>
<Emojify text={title} i18n={i18n} />
</span> </span>
) : null; ) : null;
@ -44,14 +53,7 @@ export class ContactName extends React.Component<Props> {
<span className={classNames(prefix, compact && 'compact')} dir="auto"> <span className={classNames(prefix, compact && 'compact')} dir="auto">
{profileElement} {profileElement}
{shouldShowProfile ? ' ' : null} {shouldShowProfile ? ' ' : null}
<span {pubKeyElement}
className={classNames(
`${prefix}__profile-number`,
shouldShowProfile && 'italic'
)}
>
<Emojify text={title} i18n={i18n} />
</span>
</span> </span>
); );
} }

@ -179,16 +179,7 @@ class ConversationHeader extends React.Component<Props> {
<span className="module-conversation-header__title-text">{text}</span> <span className="module-conversation-header__title-text">{text}</span>
); );
let title; const title = profileName || name || phoneNumber;
if (profileName) {
title = `${profileName} ${window.shortenPubkey(phoneNumber)}`;
} else {
if (name) {
title = `${name}`;
} else {
title = `User ${window.shortenPubkey(phoneNumber)}`;
}
}
return ( return (
<div className="module-conversation-header__title"> <div className="module-conversation-header__title">

@ -1074,6 +1074,7 @@ export class Message extends React.PureComponent<Props, State> {
conversationType, conversationType,
direction, direction,
i18n, i18n,
isPublic,
} = this.props; } = this.props;
const title = authorName ? authorName : authorPhoneNumber; const title = authorName ? authorName : authorPhoneNumber;
@ -1097,6 +1098,7 @@ export class Message extends React.PureComponent<Props, State> {
module="module-message__author" module="module-message__author"
i18n={i18n} i18n={i18n}
boldProfileName={true} boldProfileName={true}
shouldShowPubkey={Boolean(isPublic)}
/> />
</div> </div>
); );

@ -107,6 +107,7 @@ export class MessageDetail extends React.Component<Props> {
name={contact.name} name={contact.name}
profileName={contact.profileName} profileName={contact.profileName}
i18n={i18n} i18n={i18n}
shouldShowPubkey={true}
/> />
</div> </div>
{errors.map((error, index) => ( {errors.map((error, index) => (

@ -302,6 +302,7 @@ export class Quote extends React.Component<Props, State> {
i18n, i18n,
isFromMe, isFromMe,
isIncoming, isIncoming,
isPublic,
} = this.props; } = this.props;
return ( return (
@ -320,6 +321,7 @@ export class Quote extends React.Component<Props, State> {
profileName={authorProfileName} profileName={authorProfileName}
i18n={i18n} i18n={i18n}
compact={true} compact={true}
shouldShowPubkey={Boolean(isPublic)}
/> />
)} )}
</div> </div>

@ -42,6 +42,7 @@ export class SafetyNumberNotification extends React.Component<Props> {
profileName={contact.profileName} profileName={contact.profileName}
phoneNumber={contact.phoneNumber} phoneNumber={contact.phoneNumber}
module="module-verification-notification__contact" module="module-verification-notification__contact"
shouldShowPubkey={true}
/> />
</span>, </span>,
]} ]}

@ -51,6 +51,7 @@ export class TimerNotification extends React.Component<Props> {
name={name} name={name}
module="module-message__author" module="module-message__author"
boldProfileName={true} boldProfileName={true}
shouldShowPubkey={false}
/>, />,
timespan, timespan,
]} ]}

@ -53,6 +53,7 @@ export class VerificationNotification extends React.Component<Props> {
profileName={contact.profileName} profileName={contact.profileName}
phoneNumber={contact.phoneNumber} phoneNumber={contact.phoneNumber}
module="module-verification-notification__contact" module="module-verification-notification__contact"
shouldShowPubkey={true}
/>, />,
]} ]}
i18n={i18n} i18n={i18n}

@ -49,8 +49,6 @@ export class SessionMemberListItem extends React.Component<Props, State> {
const { isSelected } = this.state; const { isSelected } = this.state;
const name = this.props.member.authorProfileName; const name = this.props.member.authorProfileName;
const pubkey = this.props.member.authorPhoneNumber;
const shortPubkey = window.shortenPubkey(pubkey);
return ( return (
<div <div
@ -67,7 +65,6 @@ export class SessionMemberListItem extends React.Component<Props, State> {
{this.renderAvatar()} {this.renderAvatar()}
</span> </span>
<span className="session-member-item__name">{name}</span> <span className="session-member-item__name">{name}</span>
<span className="session-member-item__pubkey">{shortPubkey}</span>
</div> </div>
<span <span
className={classNames( className={classNames(

@ -583,8 +583,6 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
title = window.i18n('anonymous'); title = window.i18n('anonymous');
} }
title = `${title} ${window.shortenPubkey(blockedNumber)}`;
results.push({ results.push({
id: blockedNumber, id: blockedNumber,
title, title,

Loading…
Cancel
Save