Skip to content

Commit

Permalink
Hide post report images. Fixes #824 (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines authored Nov 18, 2022
1 parent 78a6a19 commit f90fa6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/shared/components/post/post-listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ interface PostListingProps {
allLanguages: Language[];
showCommunity?: boolean;
showBody?: boolean;
hideImage?: boolean;
enableDownvotes?: boolean;
enableNsfw?: boolean;
viewOnly?: boolean;
Expand Down Expand Up @@ -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} />}
Expand Down Expand Up @@ -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()}
Expand All @@ -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"
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/shared/components/post/post-report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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} />
Expand Down

0 comments on commit f90fa6d

Please sign in to comment.