always show community name with instance for easy copy-pasting to friends (#2073)

* always show community name with instance for easy copy-pasting to friends

I don't like the inconsistency of community names currently, the UI shouldn't be presenting things differently because of technical reasons that are hard for users to understand. This makes it easier to share communities with your friends!

* always show community name with instance, cleanup
This commit is contained in:
Die4Ever 2023-08-30 13:52:36 -05:00 committed by GitHub
parent b2927c36a2
commit 6224c4e378
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,20 +21,19 @@ export class CommunityLink extends Component<CommunityLinkProps, any> {
render() { render() {
const community = this.props.community; const community = this.props.community;
let name_: string, title: string, link: string; let title: string, link: string;
const local = community.local === null ? true : community.local; const local = community.local === null ? true : community.local;
const domain = hostname(community.actor_id);
if (local) { if (local) {
name_ = community.name;
title = community.title; title = community.title;
link = `/c/${community.name}`; link = `/c/${community.name}`;
} else { } else {
const domain = hostname(community.actor_id); const name_ = `${community.name}@${domain}`;
name_ = `${community.name}@${domain}`;
title = `${community.title}@${domain}`; title = `${community.title}@${domain}`;
link = !this.props.realLink ? `/c/${name_}` : community.actor_id; link = !this.props.realLink ? `/c/${name_}` : community.actor_id;
} }
const apubName = `!${name_}`; const apubName = `!${community.name}@${domain}`;
const displayName = this.props.useApubName ? apubName : title; const displayName = this.props.useApubName ? apubName : title;
return !this.props.realLink ? ( return !this.props.realLink ? (
<Link <Link