mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 22:01:13 +00:00
Fix non-local community and person links. Fixes #290
This commit is contained in:
parent
b0e456d754
commit
fed9bddbb2
2 changed files with 48 additions and 12 deletions
|
@ -36,17 +36,34 @@ export class CommunityLink extends Component<CommunityLinkProps, any> {
|
||||||
|
|
||||||
let apubName = `!${name_}`;
|
let apubName = `!${name_}`;
|
||||||
let displayName = this.props.useApubName ? apubName : title;
|
let displayName = this.props.useApubName ? apubName : title;
|
||||||
return (
|
return !this.props.realLink ? (
|
||||||
<Link
|
<Link
|
||||||
title={apubName}
|
title={apubName}
|
||||||
className={`${this.props.muted ? "text-muted" : ""}`}
|
className={`${this.props.muted ? "text-muted" : ""}`}
|
||||||
to={link}
|
to={link}
|
||||||
>
|
>
|
||||||
|
{this.avatarAndName(displayName)}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<a
|
||||||
|
title={apubName}
|
||||||
|
className={`${this.props.muted ? "text-muted" : ""}`}
|
||||||
|
href={link}
|
||||||
|
>
|
||||||
|
{this.avatarAndName(displayName)}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
avatarAndName(displayName: string) {
|
||||||
|
let community = this.props.community;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
{!this.props.hideAvatar && community.icon && showAvatars() && (
|
{!this.props.hideAvatar && community.icon && showAvatars() && (
|
||||||
<PictrsImage src={community.icon} icon />
|
<PictrsImage src={community.icon} icon />
|
||||||
)}
|
)}
|
||||||
<span>{displayName}</span>
|
<span>{displayName}</span>
|
||||||
</Link>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,19 +44,38 @@ export class PersonListing extends Component<PersonListingProps, any> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Link
|
{!this.props.realLink ? (
|
||||||
title={apubName}
|
<Link
|
||||||
className={this.props.muted ? "text-muted" : "text-info"}
|
title={apubName}
|
||||||
to={link}
|
className={this.props.muted ? "text-muted" : "text-info"}
|
||||||
>
|
to={link}
|
||||||
{!this.props.hideAvatar && person.avatar && showAvatars() && (
|
>
|
||||||
<PictrsImage src={person.avatar} icon />
|
{this.avatarAndName(displayName)}
|
||||||
)}
|
</Link>
|
||||||
<span>{displayName}</span>
|
) : (
|
||||||
</Link>
|
<a
|
||||||
|
title={apubName}
|
||||||
|
className={this.props.muted ? "text-muted" : "text-info"}
|
||||||
|
href={link}
|
||||||
|
>
|
||||||
|
{this.avatarAndName(displayName)}
|
||||||
|
</a>
|
||||||
|
)}
|
||||||
|
|
||||||
{isCakeDay(person.published) && <CakeDay creatorName={apubName} />}
|
{isCakeDay(person.published) && <CakeDay creatorName={apubName} />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
avatarAndName(displayName: string) {
|
||||||
|
let person = this.props.person;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{!this.props.hideAvatar && person.avatar && showAvatars() && (
|
||||||
|
<PictrsImage src={person.avatar} icon />
|
||||||
|
)}
|
||||||
|
<span>{displayName}</span>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue