diff --git a/src/components/VerifiedAuthor.jsx b/src/components/VerifiedAuthor.jsx
new file mode 100644
index 00000000..5a832381
--- /dev/null
+++ b/src/components/VerifiedAuthor.jsx
@@ -0,0 +1,10 @@
+import {useComment, useAuthorAddress} from '@plebbit/plebbit-react-hooks';
+
+function VerifiedAuthor({ commentCid, children }) {
+ const comment = useComment({commentCid});
+ const {authorAddress, shortAuthorAddress} = useAuthorAddress({comment});
+
+ return children({ authorAddress, shortAuthorAddress });
+}
+
+export default VerifiedAuthor;
\ No newline at end of file
diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx
index a6b45e42..68e4e058 100755
--- a/src/components/views/All.jsx
+++ b/src/components/views/All.jsx
@@ -21,6 +21,7 @@ import Post from '../Post';
import PostLoader from '../PostLoader';
import PostOnHover from '../PostOnHover';
import StateLabel from '../StateLabel';
+import VerifiedAuthor from '../VerifiedAuthor';
import ReplyModal from '../modals/ReplyModal';
import SettingsModal from '../modals/SettingsModal';
import findShortParentCid from '../../utils/findShortParentCid';
@@ -771,9 +772,9 @@ const All = () => {
(u/
handleAddressClick(thread.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
- {thread.author.shortAddress}
+ {{({ shortAuthorAddress }) => (shortAuthorAddress)}}
)
{getDate(thread.timestamp)}
@@ -848,8 +849,8 @@ const All = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post
- {handleAuthorDeleteClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
@@ -857,8 +858,8 @@ const All = () => {
) : null}
{isModerator ? (
<>
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
@@ -1043,7 +1044,7 @@ const All = () => {
handleAddressClick(reply.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
{reply.author?.shortAddress ?
@@ -1138,8 +1139,8 @@ const All = () => {
>
- handleOptionClick(reply.cid)}>Hide post
- {reply.author.address === account?.author.address ||
- reply.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post
- {handleAuthorDeleteClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
@@ -1147,8 +1148,8 @@ const All = () => {
) : null}
{isModerator ? (
<>
- {reply.author.address === account?.author.address ||
- reply.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
@@ -1563,11 +1564,11 @@ const All = () => {
handleAddressClick(thread.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
- {thread.author.shortAddress}
+ {{({ shortAuthorAddress }) => (shortAuthorAddress)}}
)
@@ -1803,7 +1804,7 @@ const All = () => {
handleAddressClick(reply.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
{reply.author?.shortAddress ?
diff --git a/src/components/views/AllCatalog.jsx b/src/components/views/AllCatalog.jsx
index cf9b5a63..6400ecba 100755
--- a/src/components/views/AllCatalog.jsx
+++ b/src/components/views/AllCatalog.jsx
@@ -13,6 +13,7 @@ import { TopBar, Footer, AuthorDeleteAlert } from '../styled/views/Thread.styled
import CatalogLoader from '../CatalogLoader';
import EditModal from '../modals/EditModal';
import ImageBanner from '../ImageBanner';
+import VerifiedAuthor from '../VerifiedAuthor';
import ModerationModal from '../modals/ModerationModal';
import OfflineIndicator from '../OfflineIndicator';
import SettingsModal from '../modals/SettingsModal';
@@ -559,8 +560,8 @@ const AllCatalog = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- handleAuthorEditClick(thread)}>Edit post
- handleAuthorDeleteClick(thread)}>Delete post
@@ -568,8 +569,8 @@ const AllCatalog = () => {
) : null}
{isModerator ? (
<>
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx
index 0d1d5ea8..f9109d95 100755
--- a/src/components/views/Board.jsx
+++ b/src/components/views/Board.jsx
@@ -22,6 +22,7 @@ import Post from '../Post';
import PostLoader from '../PostLoader';
import PostOnHover from '../PostOnHover';
import StateLabel from '../StateLabel';
+import VerifiedAuthor from '../VerifiedAuthor';
import ReplyModal from '../modals/ReplyModal';
import SettingsModal from '../modals/SettingsModal';
import findShortParentCid from '../../utils/findShortParentCid';
@@ -1417,9 +1418,9 @@ const Board = () => {
(u/
handleAddressClick(thread.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
- {thread.author.shortAddress}
+ {({ shortAuthorAddress }) => (shortAuthorAddress)}
)
{getDate(thread.timestamp)}
@@ -1497,8 +1498,8 @@ const Board = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- handleAuthorEditClick(thread)}>Edit post
- handleAuthorDeleteClick(thread)}>Delete post
@@ -1506,8 +1507,8 @@ const Board = () => {
) : null}
{isModerator ? (
<>
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
@@ -1700,7 +1701,7 @@ const Board = () => {
handleAddressClick(reply.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
{reply.author?.shortAddress ?
@@ -1780,8 +1781,8 @@ const Board = () => {
>
- handleOptionClick(reply.cid)}>Hide post
- {reply.author.address === account?.author.address ||
- reply.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- handleAuthorEditClick(reply)}>Edit post
- handleAuthorDeleteClick(reply)}>Delete post
@@ -1789,8 +1790,8 @@ const Board = () => {
) : null}
{isModerator ? (
<>
- {reply.author.address === account?.author.address ||
- reply.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
@@ -2203,11 +2204,11 @@ const Board = () => {
handleAddressClick(thread.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
- {thread.author.shortAddress}
+ {{({ shortAuthorAddress }) => (shortAuthorAddress)}}
)
@@ -2442,7 +2443,7 @@ const Board = () => {
handleAddressClick(reply.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
{reply.author?.shortAddress ?
diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx
index 8702120b..f3262287 100755
--- a/src/components/views/Catalog.jsx
+++ b/src/components/views/Catalog.jsx
@@ -13,6 +13,7 @@ import { TopBar, Footer, AuthorDeleteAlert } from '../styled/views/Thread.styled
import CatalogLoader from '../CatalogLoader';
import EditModal from '../modals/EditModal';
import ImageBanner from '../ImageBanner';
+import VerifiedAuthor from '../VerifiedAuthor';
import ModerationModal from '../modals/ModerationModal';
import OfflineIndicator from '../OfflineIndicator';
import SettingsModal from '../modals/SettingsModal';
@@ -1007,8 +1008,8 @@ const Catalog = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- handleAuthorEditClick(thread)}>Edit post
- handleAuthorDeleteClick(thread)}>Delete post
@@ -1016,8 +1017,8 @@ const Catalog = () => {
) : null}
{isModerator ? (
<>
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/Subscriptions.jsx b/src/components/views/Subscriptions.jsx
index 0206bd43..5651dd13 100755
--- a/src/components/views/Subscriptions.jsx
+++ b/src/components/views/Subscriptions.jsx
@@ -22,6 +22,7 @@ import Post from '../Post';
import PostLoader from '../PostLoader';
import PostOnHover from '../PostOnHover';
import StateLabel from '../StateLabel';
+import VerifiedAuthor from '../VerifiedAuthor';
import ReplyModal from '../modals/ReplyModal';
import SettingsModal from '../modals/SettingsModal';
import findShortParentCid from '../../utils/findShortParentCid';
@@ -782,9 +783,9 @@ const Subscriptions = () => {
(u/
handleAddressClick(thread.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
- {thread.author.shortAddress}
+ {{({ shortAuthorAddress }) => (shortAuthorAddress)}}
)
{getDate(thread.timestamp)}
@@ -859,8 +860,8 @@ const Subscriptions = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post
- {handleAuthorDeleteClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
@@ -868,8 +869,8 @@ const Subscriptions = () => {
) : null}
{isModerator ? (
<>
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
@@ -1054,7 +1055,7 @@ const Subscriptions = () => {
handleAddressClick(reply.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
{reply.author?.shortAddress ?
@@ -1149,8 +1150,8 @@ const Subscriptions = () => {
>
- handleOptionClick(reply.cid)}>Hide post
- {reply.author.address === account?.author.address ||
- reply.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post
- {handleAuthorDeleteClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
@@ -1158,8 +1159,8 @@ const Subscriptions = () => {
) : null}
{isModerator ? (
<>
- {reply.author.address === account?.author.address ||
- reply.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
@@ -1574,11 +1575,11 @@ const Subscriptions = () => {
handleAddressClick(thread.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
- {thread.author.shortAddress}
+ {{({ shortAuthorAddress }) => (shortAuthorAddress)}}
)
@@ -1814,7 +1815,7 @@ const Subscriptions = () => {
handleAddressClick(reply.author.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
{reply.author?.shortAddress ?
diff --git a/src/components/views/SubscriptionsCatalog.jsx b/src/components/views/SubscriptionsCatalog.jsx
index 539f45e0..0fe0369c 100755
--- a/src/components/views/SubscriptionsCatalog.jsx
+++ b/src/components/views/SubscriptionsCatalog.jsx
@@ -14,6 +14,7 @@ import { TopBar, Footer, AuthorDeleteAlert } from '../styled/views/Thread.styled
import CatalogLoader from '../CatalogLoader';
import EditModal from '../modals/EditModal';
import ImageBanner from '../ImageBanner';
+import VerifiedAuthor from '../VerifiedAuthor';
import ModerationModal from '../modals/ModerationModal';
import OfflineIndicator from '../OfflineIndicator';
import SettingsModal from '../modals/SettingsModal';
@@ -563,8 +564,8 @@ const SubscriptionsCatalog = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- handleAuthorEditClick(thread)}>Edit post
- handleAuthorDeleteClick(thread)}>Delete post
@@ -572,8 +573,8 @@ const SubscriptionsCatalog = () => {
) : null}
{isModerator ? (
<>
- {thread.author.address === account?.author.address ||
- thread.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx
index ad7813a3..6931b402 100755
--- a/src/components/views/Thread.jsx
+++ b/src/components/views/Thread.jsx
@@ -20,6 +20,7 @@ import Post from '../Post';
import PostLoader from '../PostLoader';
import PostOnHover from '../PostOnHover';
import StateLabel from '../StateLabel';
+import VerifiedAuthor from '../VerifiedAuthor';
import ReplyModal from '../modals/ReplyModal';
import SettingsModal from '../modals/SettingsModal';
import findShortParentCid from '../../utils/findShortParentCid';
@@ -952,10 +953,10 @@ const Thread = () => {
handleAddressClick(comment?.author?.shortAddress)}>
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}>
(u/
- {comment?.author?.shortAddress}
+ {{({ shortAuthorAddress }) => (shortAuthorAddress)}}
)
@@ -1023,8 +1024,8 @@ const Thread = () => {
>
- handleOptionClick(comment.cid)}>Hide thread
- {comment.author?.address === account?.author.address ||
- comment.author?.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- handleAuthorEditClick(comment)}>Edit post
- handleAuthorDeleteClick(comment)}>Delete post
@@ -1032,8 +1033,8 @@ const Thread = () => {
) : null}
{isModerator ? (
<>
- {comment.author?.address === account?.author.address ||
- comment.author?.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
@@ -1271,8 +1272,8 @@ const Thread = () => {
>
- handleOptionClick(reply.cid)}>Hide post
- {reply.author.address === account?.author.address ||
- reply.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
<>
- handleAuthorEditClick(reply)}>Edit post
- handleAuthorDeleteClick(reply)}>Delete post
@@ -1280,8 +1281,8 @@ const Thread = () => {
) : null}
{isModerator ? (
<>
- {reply.author.address === account?.author.address ||
- reply.author.address === account?.signer.address ? (
+ {{({ authorAddress }) => (authorAddress)} === account?.author.address ||
+ {({ authorAddress }) => (authorAddress)} === account?.signer.address ? (
null
) : (
- {
@@ -1578,11 +1579,11 @@ const Thread = () => {
handleAddressClick(comment?.author?.shortAddress)}
+ onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})}
>
(u/
- {comment?.author?.shortAddress}
+ {{({ shortAuthorAddress }) => (shortAuthorAddress)}}
)