]> Untitled Git - lemmy-ui.git/commitdiff
Fix wrong comment link. Fixes #714 (#865)
authorDessalines <dessalines@users.noreply.github.com>
Sat, 19 Nov 2022 04:39:32 +0000 (23:39 -0500)
committerGitHub <noreply@github.com>
Sat, 19 Nov 2022 04:39:32 +0000 (23:39 -0500)
src/shared/components/post/post-listing.tsx

index d513b10452e0bb4dfdbd1d5e34ce603a830ebb5f..4a1966caac83535f20e9b4b9e77b371620cd9ea0 100644 (file)
@@ -448,31 +448,39 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     );
   }
 
+  get postLink() {
+    let post = this.props.post_view.post;
+    return (
+      <Link
+        className={!post.stickied ? "text-body" : "text-primary"}
+        to={`/post/${post.id}`}
+        title={i18n.t("comments")}
+      >
+        <div dangerouslySetInnerHTML={mdToHtmlInline(post.name)} />
+      </Link>
+    );
+  }
+
   postTitleLine() {
     let post = this.props.post_view.post;
     return (
       <div className="post-title overflow-hidden">
         <h5>
           {post.url.match({
-            some: url => (
-              <a
-                className={!post.stickied ? "text-body" : "text-primary"}
-                href={url}
-                title={url}
-                rel={relTags}
-              >
-                <div dangerouslySetInnerHTML={mdToHtmlInline(post.name)} />
-              </a>
-            ),
-            none: (
-              <Link
-                className={!post.stickied ? "text-body" : "text-primary"}
-                to={`/post/${post.id}`}
-                title={i18n.t("comments")}
-              >
-                <div dangerouslySetInnerHTML={mdToHtmlInline(post.name)} />
-              </Link>
-            ),
+            some: url =>
+              this.props.showBody ? (
+                <a
+                  className={!post.stickied ? "text-body" : "text-primary"}
+                  href={url}
+                  title={url}
+                  rel={relTags}
+                >
+                  <div dangerouslySetInnerHTML={mdToHtmlInline(post.name)} />
+                </a>
+              ) : (
+                this.postLink
+              ),
+            none: this.postLink,
           })}
           {post.url.map(isImage).or(post.thumbnail_url).unwrapOr(false) && (
             <button