mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 19:14:16 +00:00
use app.permissions.checkUserIdIsSelf
instead pass selfId
prop
This commit is contained in:
parent
e7fab7e013
commit
d16e7b5ba6
@ -11,7 +11,6 @@ import PostActions from "./components/actions"
|
|||||||
import "./index.less"
|
import "./index.less"
|
||||||
|
|
||||||
export default React.memo(({
|
export default React.memo(({
|
||||||
selfId,
|
|
||||||
expansibleActions = window.app.settings.get("postCard_expansible_actions"),
|
expansibleActions = window.app.settings.get("postCard_expansible_actions"),
|
||||||
autoCarrousel = window.app.settings.get("postCard_carrusel_auto"),
|
autoCarrousel = window.app.settings.get("postCard_carrusel_auto"),
|
||||||
data = {},
|
data = {},
|
||||||
@ -100,11 +99,13 @@ export default React.memo(({
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
// check if the post has liked by you
|
if (!app.userData) {
|
||||||
const hasLiked = likes.includes(selfId)
|
return
|
||||||
const hasSaved = data.isSaved
|
}
|
||||||
|
|
||||||
//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)
|
setHasLiked(hasLiked)
|
||||||
setHasSaved(hasSaved)
|
setHasSaved(hasSaved)
|
||||||
@ -148,7 +149,7 @@ export default React.memo(({
|
|||||||
}
|
}
|
||||||
{!fullmode &&
|
{!fullmode &&
|
||||||
<PostActions
|
<PostActions
|
||||||
isSelf={selfId === data.user_id}
|
isSelf={app.permissions.checkUserIdIsSelf(data.user_id)}
|
||||||
defaultLiked={hasLiked}
|
defaultLiked={hasLiked}
|
||||||
defaultSaved={hasSaved}
|
defaultSaved={hasSaved}
|
||||||
onClickLike={onClickLike}
|
onClickLike={onClickLike}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user