From cda1e6e74141efea556e81082a3468a012d2926d Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Sun, 2 Feb 2020 10:09:01 -0500
Subject: Fixing issue with multiple notifications.

---
 ui/src/components/post.tsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'ui/src/components/post.tsx')

diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index 99a20b46..fcf79438 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -400,8 +400,12 @@ export class Post extends Component<any, PostState> {
       this.setState(this.state);
     } else if (res.op == UserOperation.CreateComment) {
       let data = res.data as CommentResponse;
-      this.state.comments.unshift(data.comment);
-      this.setState(this.state);
+
+      // Necessary since a user might receive a comment reply on another thread
+      if (data.comment.post_id == this.state.post.id) {
+        this.state.comments.unshift(data.comment);
+        this.setState(this.state);
+      }
     } else if (res.op == UserOperation.EditComment) {
       let data = res.data as CommentResponse;
       let found = this.state.comments.find(c => c.id == data.comment.id);
-- 
cgit v1.2.3

