From c98a108ee3f15136d3bf893054259130aaf6f2fa Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Mon, 16 Nov 2020 16:19:10 -0600
Subject: [PATCH] fixing federated community / cross-post display links. Fixes
 #75

---
 src/shared/components/post-listing.tsx |  8 +++++++-
 src/shared/components/user.tsx         | 25 +++++++++++++++++++------
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/src/shared/components/post-listing.tsx b/src/shared/components/post-listing.tsx
index 6545b2a..809b8d1 100644
--- a/src/shared/components/post-listing.tsx
+++ b/src/shared/components/post-listing.tsx
@@ -617,7 +617,13 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
             </li>
             {this.props.post.duplicates.map(post => (
               <li className="list-inline-item mr-2">
-                <Link to={`/post/${post.id}`}>{post.community_name}</Link>
+                <Link to={`/post/${post.id}`}>
+                  {post.community_local
+                    ? post.community_name
+                    : `${post.community_name}@${hostname(
+                        post.community_actor_id
+                      )}`}
+                </Link>
               </li>
             ))}
           </>
diff --git a/src/shared/components/user.tsx b/src/shared/components/user.tsx
index 3c50adf..8f593cc 100644
--- a/src/shared/components/user.tsx
+++ b/src/shared/components/user.tsx
@@ -55,6 +55,7 @@ import { UserDetails } from './user-details';
 import { MarkdownTextArea } from './markdown-textarea';
 import { ImageUploadForm } from './image-upload-form';
 import { BannerIconHeader } from './banner-icon-header';
+import { CommunityLink } from './community-link';
 
 interface UserState {
   userRes: UserDetailsResponse;
@@ -841,9 +842,15 @@ export class User extends Component<any, UserState> {
               <ul class="list-unstyled mb-0">
                 {this.state.userRes.moderates.map(community => (
                   <li>
-                    <Link to={`/c/${community.community_name}`}>
-                      {community.community_name}
-                    </Link>
+                    <CommunityLink
+                      community={{
+                        name: community.community_name,
+                        id: community.community_id,
+                        local: community.community_local,
+                        actor_id: community.community_actor_id,
+                        icon: community.community_icon,
+                      }}
+                    />
                   </li>
                 ))}
               </ul>
@@ -864,9 +871,15 @@ export class User extends Component<any, UserState> {
               <ul class="list-unstyled mb-0">
                 {this.state.userRes.follows.map(community => (
                   <li>
-                    <Link to={`/c/${community.community_name}`}>
-                      {community.community_name}
-                    </Link>
+                    <CommunityLink
+                      community={{
+                        name: community.community_name,
+                        id: community.community_id,
+                        local: community.community_local,
+                        actor_id: community.community_actor_id,
+                        icon: community.community_icon,
+                      }}
+                    />
                   </li>
                 ))}
               </ul>
-- 
2.44.1