From d16e7b5ba6bfb3044e278cc468e9dafc5ea2ec6b Mon Sep 17 00:00:00 2001 From: srgooglo Date: Tue, 11 Oct 2022 14:56:38 +0200 Subject: [PATCH] use `app.permissions.checkUserIdIsSelf` instead pass `selfId` prop --- packages/app/src/components/PostCard/index.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/app/src/components/PostCard/index.jsx b/packages/app/src/components/PostCard/index.jsx index 20c7f45c..fb7c3bb9 100644 --- a/packages/app/src/components/PostCard/index.jsx +++ b/packages/app/src/components/PostCard/index.jsx @@ -11,7 +11,6 @@ import PostActions from "./components/actions" import "./index.less" export default React.memo(({ - selfId, expansibleActions = window.app.settings.get("postCard_expansible_actions"), autoCarrousel = window.app.settings.get("postCard_carrusel_auto"), data = {}, @@ -100,11 +99,13 @@ export default React.memo(({ }, []) React.useEffect(() => { - // check if the post has liked by you - const hasLiked = likes.includes(selfId) - const hasSaved = data.isSaved + if (!app.userData) { + return + } - //console.log(`[${data._id}] CHECKING LIKE OF USER ${selfId} > ${hasLiked}`) + // check if the post has liked by you + const hasLiked = likes.includes(app.userData._id) + const hasSaved = data.isSaved setHasLiked(hasLiked) setHasSaved(hasSaved) @@ -148,7 +149,7 @@ export default React.memo(({ } {!fullmode &&