From 7d2bd38f58d45e615a28b2fbd5a7ba6f58247d01 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sun, 8 Sep 2024 16:58:25 +0200 Subject: [PATCH] fix(post): "(You)" wasn't appearing for comments published in anon mode by user --- src/components/board-buttons/board-buttons.module.css | 2 +- .../reply-quote-preview/reply-quote-preview.tsx | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/board-buttons/board-buttons.module.css b/src/components/board-buttons/board-buttons.module.css index ddadba4a..69664298 100644 --- a/src/components/board-buttons/board-buttons.module.css +++ b/src/components/board-buttons/board-buttons.module.css @@ -30,7 +30,7 @@ } .disabledButton { - opacity: 0.5; + opacity: 0.5 !important; } .disabledButton:hover { diff --git a/src/components/reply-quote-preview/reply-quote-preview.tsx b/src/components/reply-quote-preview/reply-quote-preview.tsx index 407aae8c..90982e4d 100644 --- a/src/components/reply-quote-preview/reply-quote-preview.tsx +++ b/src/components/reply-quote-preview/reply-quote-preview.tsx @@ -3,6 +3,7 @@ import { createPortal } from 'react-dom'; import { Link, useNavigate } from 'react-router-dom'; import { Comment, useAccount } from '@plebbit/plebbit-react-hooks'; import { useFloating, offset, shift, size, autoUpdate, Placement } from '@floating-ui/react'; +import useAnonModeStore from '../../stores/use-anon-mode-store'; import useIsMobile from '../../hooks/use-is-mobile'; import styles from '../../views/post/post.module.css'; import { Post } from '../../views/post'; @@ -143,6 +144,8 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i ); const account = useAccount(); + const { getThreadSigner } = useAnonModeStore(); + const threadSigner = quotelinkReply?.postCid ? getThreadSigner(quotelinkReply?.postCid) : null; const replyQuotelink = ( <> @@ -155,7 +158,7 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i onClick={(e) => handleClick(e, quotelinkReply?.cid, quotelinkReply?.subplebbitAddress)} > {quotelinkReply?.shortCid && `c/${quotelinkReply?.shortCid}`} - {quotelinkReply?.author?.address === account?.author?.address && ' (You)'} + {(quotelinkReply?.author?.address === account?.author?.address || quotelinkReply?.author?.address === threadSigner?.address) && ' (You)'}
{hoveredCid === quotelinkReply?.cid && @@ -252,6 +255,8 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is ); const account = useAccount(); + const { getThreadSigner } = useAnonModeStore(); + const threadSigner = quotelinkReply?.postCid ? getThreadSigner(quotelinkReply?.postCid) : null; const replyQuotelink = ( <> @@ -262,7 +267,7 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)} > {quotelinkReply?.shortCid && `c/${quotelinkReply?.shortCid}`} - {quotelinkReply?.author?.address === account?.author?.address && ' (You)'} + {(quotelinkReply?.author?.address === account?.author?.address || quotelinkReply?.author?.address === threadSigner?.address) && ' (You)'} {quotelinkReply?.shortCid && (