]> Untitled Git - lemmy-ui.git/commitdiff
fixing federated community / cross-post display links. Fixes #75
authorDessalines <tyhou13@gmx.com>
Mon, 16 Nov 2020 22:19:10 +0000 (16:19 -0600)
committerDessalines <tyhou13@gmx.com>
Mon, 16 Nov 2020 22:19:10 +0000 (16:19 -0600)
src/shared/components/post-listing.tsx
src/shared/components/user.tsx

index 6545b2a57f142b9cc60112f1f9d698a1c15a498b..809b8d12589b14779d9250085f0c90fd0d39273e 100644 (file)
@@ -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>
             ))}
           </>
index 3c50adf8ac06d5ea5457e5983f742040c421aace..8f593cc97b17bac96b7a488ba999786e880a34c3 100644 (file)
@@ -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>