From b107f978a286bd20d1367d5b3ca07c481cf1526d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Chlo=C3=A9=20JACOB?= <chloe.jacob4@etu.unistra.fr>
Date: Sun, 26 Mar 2023 22:59:20 +0200
Subject: [PATCH] =?UTF-8?q?afficher=20la=20possibilit=C3=A9=20de=20comment?=
 =?UTF-8?q?er=20ou=20non?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/Post.tsx | 6 ++++--
 src/views/PostView.tsx  | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/components/Post.tsx b/src/components/Post.tsx
index 01ff380..03a1636 100644
--- a/src/components/Post.tsx
+++ b/src/components/Post.tsx
@@ -33,12 +33,12 @@ type PostProps = {
     comments: number;
     comment_post: Instalike.Comment[];
     inFeed: boolean;
-    canCommment: boolean;
+    comment_able: boolean;
 };
 
 
 
-const Post = ({ post, postid, username, location, time_post, img, caption, isLiked, likes, comments, comment_post, inFeed, canCommment }: PostProps) => {
+const Post = ({ post, postid, username, location, time_post, img, caption, isLiked, likes, comments, comment_post, inFeed, comment_able }: PostProps) => {
   const dispatch = useAppDispatch();
   const [dropdownOpen, setDropdownOpen] = useState(false);
   const [navigateToPost, setnavigateToPost] = useState(false);
@@ -180,9 +180,11 @@ const Post = ({ post, postid, username, location, time_post, img, caption, isLik
           </div>
       </div>
       {/* ADD COMMENT */}
+      {comment_able === false &&
         <div>
           <AddComment idPost={post.id} key={post.id}></AddComment>
         </div>
+      }
       {/* COMMENTS POST */}
       <div className={`border-t-${comments > 0 ? '[0.8px] p-4' : '0' } flex flex-col gap-4`}>
           <Comment tab_comments={comment_post}></Comment>
diff --git a/src/views/PostView.tsx b/src/views/PostView.tsx
index 836eafc..0597973 100644
--- a/src/views/PostView.tsx
+++ b/src/views/PostView.tsx
@@ -47,6 +47,7 @@ const PostView = () => {
               comments={post.commentsCount}
               comment_post={post.previewComments}
               inFeed={false}
+              comment_able={post.hasCommentsDisabled}
             ></Post>
             )}
         </div>
-- 
GitLab