diff --git a/frontend/src/components/Board/Card/CardBoard.tsx b/frontend/src/components/Board/Card/CardBoard.tsx index 9a498f539..ea407e290 100644 --- a/frontend/src/components/Board/Card/CardBoard.tsx +++ b/frontend/src/components/Board/Card/CardBoard.tsx @@ -64,8 +64,16 @@ const CardBoard = React.memo( const [editing, setEditing] = useState(false); const [deleting, setDeleting] = useState(false); + const createdBy = useMemo(() => { + if (Object.hasOwnProperty.call(card, 'items')) { + const cardTyped = card as CardType; + return cardTyped.items[cardTyped.items.length - 1].createdBy; + } + return card.createdBy; + }, [card]); + const handleOpenComments = () => { - if (hideCards && card.createdBy?._id !== userId) return; + if (hideCards && createdBy?._id !== userId) return; setOpenComments(!isCommentsOpened); }; diff --git a/frontend/src/components/Board/Card/CardFooter.tsx b/frontend/src/components/Board/Card/CardFooter.tsx index d4330f7ca..18f18d1db 100644 --- a/frontend/src/components/Board/Card/CardFooter.tsx +++ b/frontend/src/components/Board/Card/CardFooter.tsx @@ -139,7 +139,7 @@ const CardFooter = React.memo( const handleDeleteVote = (event: React.MouseEvent) => { event.stopPropagation(); - if (hideCards && card.createdBy?._id !== userId) return; + if (hideCards && createdBy?._id !== userId) return; if (user && user.votesCount + countVotes <= 0) return; setDisableVoteButton(true); setCountVotes(countVotes - 1); @@ -147,7 +147,7 @@ const CardFooter = React.memo( const handleAddVote = (event: React.MouseEvent) => { event.stopPropagation(); - if (hideCards && card.createdBy?._id !== userId) return; + if (hideCards && createdBy?._id !== userId) return; if (maxVotes && user && user.votesCount >= maxVotes) return; if (maxVotes && user && user.votesCount + countVotes >= maxVotes) return; @@ -200,7 +200,12 @@ const CardFooter = React.memo( disableVoteButton || !isMainboard || !!disableVotes || - !!(user && maxVotes && user.votesCount + countVotes >= maxVotes) + !!( + user && + maxVotes && + user.votesCount + countVotes >= maxVotes + ) || + (hideCards && createdBy?._id !== userId) } onClick={handleAddVote} > @@ -231,7 +236,8 @@ const CardFooter = React.memo( !isMainboard || votesInThisCard.length === 0 || !!(user && maxVotes && user.votesCount + countVotes <= 0) || - votesOfUserInThisCard === 0 + votesOfUserInThisCard === 0 || + (hideCards && createdBy?._id !== userId) } onClick={handleDeleteVote} > @@ -246,7 +252,10 @@ const CardFooter = React.memo( filter: cardFooterBlur(hideCards, createdBy, userId) }} > - + = ({ userId, board, socketId }) => { } const { droppableId: sourceDroppableId, index: sourceIndex } = source; - if (combine && userId) { + if (combine && userId && board.hideCards === false) { const { droppableId: combineDroppableId, draggableId: combineDraggableId } = combine; const changes: MergeCardsDto = {