]> Untitled Git - lemmy-ui.git/commitdiff
Hide post report images. Fixes #824 (#861)
authorDessalines <dessalines@users.noreply.github.com>
Fri, 18 Nov 2022 02:11:30 +0000 (21:11 -0500)
committerGitHub <noreply@github.com>
Fri, 18 Nov 2022 02:11:30 +0000 (21:11 -0500)
src/shared/components/post/post-listing.tsx
src/shared/components/post/post-report.tsx

index 7a8bdb61e8b8f98d3c1b57bbffb9a9a799b1418d..be06cb2c9000b5ddc5e98e374259428a4351f5a8 100644 (file)
@@ -93,6 +93,7 @@ interface PostListingProps {
   allLanguages: Language[];
   showCommunity?: boolean;
   showBody?: boolean;
+  hideImage?: boolean;
   enableDownvotes?: boolean;
   enableNsfw?: boolean;
   viewOnly?: boolean;
@@ -156,7 +157,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
         {!this.state.showEdit ? (
           <>
             {this.listing()}
-            {this.state.imageExpanded && this.img}
+            {this.state.imageExpanded && !this.props.hideImage && this.img}
             {post.url.isSome() &&
               this.showBody &&
               post.embed_title.isSome() && <MetadataCard post={post} />}
@@ -255,7 +256,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     let url = post.url;
     let thumbnail = post.thumbnail_url;
 
-    if (url.isSome() && isImage(url.unwrap())) {
+    if (!this.props.hideImage && url.isSome() && isImage(url.unwrap())) {
       return (
         <a
           href={this.imageSrc.unwrap()}
@@ -268,7 +269,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
           <Icon icon="image" classes="mini-overlay" />
         </a>
       );
-    } else if (url.isSome() && thumbnail.isSome()) {
+    } else if (!this.props.hideImage && url.isSome() && thumbnail.isSome()) {
       return (
         <a
           className="text-body d-inline-block position-relative mb-2"
@@ -281,7 +282,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
         </a>
       );
     } else if (url.isSome()) {
-      if (isVideo(url.unwrap())) {
+      if (!this.props.hideImage && isVideo(url.unwrap())) {
         return (
           <div className="embed-responsive embed-responsive-16by9">
             <video
index b7110486de128410c00790b63a635d71e1015de5..1ce33817b11be8ebcc87879911d580a2b2cf50fc 100644 (file)
@@ -60,6 +60,7 @@ export class PostReport extends Component<PostReportProps, any> {
           enableNsfw={true}
           viewOnly={true}
           allLanguages={[]}
+          hideImage
         />
         <div>
           {i18n.t("reporter")}: <PersonListing person={r.creator} />