]> Untitled Git - lemmy-ui.git/commitdiff
Fix report page bugs. Fixes #558 (#568)
authorDessalines <dessalines@users.noreply.github.com>
Wed, 2 Feb 2022 14:56:43 +0000 (09:56 -0500)
committerGitHub <noreply@github.com>
Wed, 2 Feb 2022 14:56:43 +0000 (09:56 -0500)
src/shared/components/comment/comment-report.tsx
src/shared/components/post/post-listing.tsx
src/shared/components/post/post-report.tsx
src/shared/utils.ts

index 8e049628303b1fd39920ee0a483976b6b50e4bcc..8a45648f68fac4f350ce855d71e093f1002a60b0 100644 (file)
@@ -56,6 +56,8 @@ export class CommentReport extends Component<CommentReportProps, any> {
           moderators={[]}
           admins={[]}
           enableDownvotes={true}
+          viewOnly={true}
+          showCommunity={true}
         />
         <div>
           {i18n.t("reporter")}: <PersonListing person={r.creator} />
index a923c1f619b1c91cbf4562f5e41d630117332ff1..61a0930289d0a0cb2fa26271d835147d51e38626 100644 (file)
@@ -82,6 +82,7 @@ interface PostListingProps {
   admins?: PersonViewSafe[];
   enableDownvotes: boolean;
   enableNsfw: boolean;
+  viewOnly?: boolean;
 }
 
 export class PostListing extends Component<PostListingProps, PostListingState> {
@@ -513,8 +514,10 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
     return (
       <div class="d-flex justify-content-start flex-wrap text-muted font-weight-bold mb-1">
         {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)}
       </div>
     );
   }
@@ -1154,7 +1157,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
         {/* The larger view*/}
         <div class="d-none d-sm-block">
           <div class="row">
-            {this.voteBar()}
+            {!this.props.viewOnly && this.voteBar()}
             <div class="col-sm-2 pr-0">
               <div class="">{this.thumbnail()}</div>
             </div>
index ff3368eb505ae52f0c0904d920a82b090bb8473a..9a8005599bfd1dd2686ccf363e21e37da26dbafa 100644 (file)
@@ -48,6 +48,7 @@ export class PostReport extends Component<PostReportProps, any> {
           showCommunity={true}
           enableDownvotes={true}
           enableNsfw={true}
+          viewOnly={true}
         />
         <div>
           {i18n.t("reporter")}: <PersonListing person={r.creator} />
index 8c29e4fabde453a95e08d2a05bf4b0c7cc5261ad..6eb0e116f55f2d6285bc5d9c71029fca7e0432a4 100644 (file)
@@ -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;
   }