From 26fbd3c8e2a47e335a618d9ce0dd6b8a0463bc34 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 2 Feb 2022 09:56:43 -0500 Subject: [PATCH] Fix report page bugs. Fixes #558 (#568) --- src/shared/components/comment/comment-report.tsx | 2 ++ src/shared/components/post/post-listing.tsx | 9 ++++++--- src/shared/components/post/post-report.tsx | 1 + src/shared/utils.ts | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/shared/components/comment/comment-report.tsx b/src/shared/components/comment/comment-report.tsx index 8e04962..8a45648 100644 --- a/src/shared/components/comment/comment-report.tsx +++ b/src/shared/components/comment/comment-report.tsx @@ -56,6 +56,8 @@ export class CommentReport extends Component { moderators={[]} admins={[]} enableDownvotes={true} + viewOnly={true} + showCommunity={true} />
{i18n.t("reporter")}: diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index a923c1f..61a0930 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -82,6 +82,7 @@ interface PostListingProps { admins?: PersonViewSafe[]; enableDownvotes: boolean; enableNsfw: boolean; + viewOnly?: boolean; } export class PostListing extends Component { @@ -513,8 +514,10 @@ export class PostListing extends Component { return (
{this.commentsButton} - {mobile && this.mobileVotes} - {UserService.Instance.myUserInfo && this.postActions(mobile)} + {mobile && !this.props.viewOnly && this.mobileVotes} + {UserService.Instance.myUserInfo && + !this.props.viewOnly && + this.postActions(mobile)}
); } @@ -1154,7 +1157,7 @@ export class PostListing extends Component { {/* The larger view*/}
- {this.voteBar()} + {!this.props.viewOnly && this.voteBar()}
{this.thumbnail()}
diff --git a/src/shared/components/post/post-report.tsx b/src/shared/components/post/post-report.tsx index ff3368e..9a80055 100644 --- a/src/shared/components/post/post-report.tsx +++ b/src/shared/components/post/post-report.tsx @@ -48,6 +48,7 @@ export class PostReport extends Component { showCommunity={true} enableDownvotes={true} enableNsfw={true} + viewOnly={true} />
{i18n.t("reporter")}: diff --git a/src/shared/utils.ts b/src/shared/utils.ts index 8c29e4f..6eb0e11 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -1105,7 +1105,7 @@ export function updatePostReportRes( data: PostReportView, reports: PostReportView[] ) { - let found = reports.find(p => p.post.id == data.post.id); + let found = reports.find(p => p.post_report.id == data.post_report.id); if (found) { found.post_report = data.post_report; } @@ -1115,7 +1115,7 @@ export function updateCommentReportRes( data: CommentReportView, reports: CommentReportView[] ) { - let found = reports.find(c => c.comment.id == data.comment.id); + let found = reports.find(c => c.comment_report.id == data.comment_report.id); if (found) { found.comment_report = data.comment_report; } -- 2.44.1