From b1e283d5decd4467cefad6becbfed56690537621 Mon Sep 17 00:00:00 2001 From: Dessalines <tyhou13@gmx.com> Date: Wed, 18 Nov 2020 16:01:05 -0600 Subject: [PATCH] Have option to show apub shortname in parenthesis. Only used in the search page. --- src/shared/components/search.tsx | 2 +- src/shared/components/user-listing.tsx | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index 0dd4748..6796ad3 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -383,7 +383,7 @@ export class Search extends Component<any, SearchState> { userListing(user: UserView) { return [ <span> - <UserListing user={user} /> + <UserListing user={user} showApubName /> </span>, <span>{` - ${i18n.t('number_of_comments', { count: user.number_of_comments, diff --git a/src/shared/components/user-listing.tsx b/src/shared/components/user-listing.tsx index 43fa16e..a8e4025 100644 --- a/src/shared/components/user-listing.tsx +++ b/src/shared/components/user-listing.tsx @@ -21,6 +21,7 @@ interface UserListingProps { useApubName?: boolean; muted?: boolean; hideAvatar?: boolean; + showApubName?: boolean; } export class UserListing extends Component<UserListingProps, any> { @@ -47,6 +48,10 @@ export class UserListing extends Component<UserListingProps, any> { ? user.preferred_username : apubName; + if (this.props.showApubName && !local && user.preferred_username) { + displayName = `${displayName} (${apubName})`; + } + return ( <> <Link -- 2.44.1