From fed9bddbb25216acd608a6231de4d28cb8be4a38 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 5 May 2021 10:57:41 -0400 Subject: [PATCH] Fix non-local community and person links. Fixes #290 --- src/shared/components/community-link.tsx | 21 +++++++++++-- src/shared/components/person-listing.tsx | 39 ++++++++++++++++++------ 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/shared/components/community-link.tsx b/src/shared/components/community-link.tsx index 5a85a127..c12f570b 100644 --- a/src/shared/components/community-link.tsx +++ b/src/shared/components/community-link.tsx @@ -36,17 +36,34 @@ export class CommunityLink extends Component { let apubName = `!${name_}`; let displayName = this.props.useApubName ? apubName : title; - return ( + return !this.props.realLink ? ( + {this.avatarAndName(displayName)} + + ) : ( + + {this.avatarAndName(displayName)} + + ); + } + + avatarAndName(displayName: string) { + let community = this.props.community; + return ( + <> {!this.props.hideAvatar && community.icon && showAvatars() && ( )} {displayName} - + ); } } diff --git a/src/shared/components/person-listing.tsx b/src/shared/components/person-listing.tsx index fda388df..17265760 100644 --- a/src/shared/components/person-listing.tsx +++ b/src/shared/components/person-listing.tsx @@ -44,19 +44,38 @@ export class PersonListing extends Component { return ( <> - - {!this.props.hideAvatar && person.avatar && showAvatars() && ( - - )} - {displayName} - + {!this.props.realLink ? ( + + {this.avatarAndName(displayName)} + + ) : ( + + {this.avatarAndName(displayName)} + + )} {isCakeDay(person.published) && } ); } + + avatarAndName(displayName: string) { + let person = this.props.person; + return ( + <> + {!this.props.hideAvatar && person.avatar && showAvatars() && ( + + )} + {displayName} + + ); + } }