fix verified author actions

This commit is contained in:
plebeius.eth
2023-07-09 16:03:46 +02:00
parent 956efdd4c3
commit ec2bc277c0
7 changed files with 1682 additions and 1636 deletions
+20 -12
View File
@@ -849,17 +849,19 @@ const All = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li> <li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? (
<> <>
<li onClick={() => {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li> {authorAddress === account?.author.address ||
<li onClick={() => {handleAuthorDeleteClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li> authorAddress === account?.signer.address ? (
<>
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
</> </>
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -883,6 +885,8 @@ const All = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
(commentMediaInfo.type === 'webpage' && (commentMediaInfo.type === 'webpage' &&
@@ -1139,17 +1143,19 @@ const All = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(reply.cid)}>Hide post</li> <li onClick={() => handleOptionClick(reply.cid)}>Hide post</li>
{<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? (
<> <>
<li onClick={() => {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li> {authorAddress === account?.author.address ||
<li onClick={() => {handleAuthorDeleteClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li> authorAddress === account?.signer.address ? (
<>
<li onClick={() => handleAuthorEditClick(reply)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(reply)}>Delete post</li>
</> </>
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -1173,6 +1179,8 @@ const All = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(replyMediaInfo && ( {(replyMediaInfo && (
replyMediaInfo.type === 'image' || replyMediaInfo.type === 'image' ||
(replyMediaInfo.type === 'webpage' && (replyMediaInfo.type === 'webpage' &&
+8 -4
View File
@@ -560,8 +560,10 @@ const AllCatalog = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li> <li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( <>
{authorAddress === account?.author.address ||
authorAddress === account?.signer.address ? (
<> <>
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li> <li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li> <li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
@@ -569,8 +571,8 @@ const AllCatalog = () => {
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -594,6 +596,8 @@ const AllCatalog = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
(commentMediaInfo.type === 'webpage' && (commentMediaInfo.type === 'webpage' &&
+18 -8
View File
@@ -1498,8 +1498,10 @@ const Board = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li> <li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( <>
{authorAddress === account?.author.address ||
authorAddress === account?.signer.address ? (
<> <>
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li> <li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li> <li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
@@ -1507,8 +1509,8 @@ const Board = () => {
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -1530,6 +1532,8 @@ const Board = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
(commentMediaInfo.type === 'webpage' && (commentMediaInfo.type === 'webpage' &&
@@ -1679,6 +1683,7 @@ const Board = () => {
signerAddress = storedSigners[reply.parentCid].address; signerAddress = storedSigners[reply.parentCid].address;
} }
return ( return (
<Fragment key={`fr-reply-${index}`}>
<div key={`rc-${index}`} className="reply-container"> <div key={`rc-${index}`} className="reply-container">
<div key={`sa-${index}`} className="side-arrows">{'>>'}</div> <div key={`sa-${index}`} className="side-arrows">{'>>'}</div>
<div key={`pr-${index}`} className="post-reply post-reply-desktop"> <div key={`pr-${index}`} className="post-reply post-reply-desktop">
@@ -1781,8 +1786,10 @@ const Board = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(reply.cid)}>Hide post</li> <li onClick={() => handleOptionClick(reply.cid)}>Hide post</li>
{<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( <>
{authorAddress === account?.author.address ||
authorAddress === account?.signer.address ? (
<> <>
<li onClick={() => handleAuthorEditClick(reply)}>Edit post</li> <li onClick={() => handleAuthorEditClick(reply)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(reply)}>Delete post</li> <li onClick={() => handleAuthorDeleteClick(reply)}>Delete post</li>
@@ -1790,8 +1797,8 @@ const Board = () => {
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -1813,6 +1820,8 @@ const Board = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(replyMediaInfo && ( {(replyMediaInfo && (
replyMediaInfo.type === 'image' || replyMediaInfo.type === 'image' ||
(replyMediaInfo.type === 'webpage' && (replyMediaInfo.type === 'webpage' &&
@@ -2173,6 +2182,7 @@ const Board = () => {
: null} : null}
</div> </div>
</div> </div>
</Fragment>
) )
})} })}
</div> </div>
+8 -4
View File
@@ -1008,8 +1008,10 @@ const Catalog = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li> <li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( <>
{authorAddress === account?.author.address ||
authorAddress === account?.signer.address ? (
<> <>
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li> <li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li> <li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
@@ -1017,8 +1019,8 @@ const Catalog = () => {
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -1040,6 +1042,8 @@ const Catalog = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
(commentMediaInfo.type === 'webpage' && (commentMediaInfo.type === 'webpage' &&
+20 -12
View File
@@ -860,17 +860,19 @@ const Subscriptions = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li> <li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? (
<> <>
<li onClick={() => {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li> {authorAddress === account?.author.address ||
<li onClick={() => {handleAuthorDeleteClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li> authorAddress === account?.signer.address ? (
<>
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
</> </>
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -894,6 +896,8 @@ const Subscriptions = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
(commentMediaInfo.type === 'webpage' && (commentMediaInfo.type === 'webpage' &&
@@ -1150,17 +1154,19 @@ const Subscriptions = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(reply.cid)}>Hide post</li> <li onClick={() => handleOptionClick(reply.cid)}>Hide post</li>
{<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? (
<> <>
<li onClick={() => {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li> {authorAddress === account?.author.address ||
<li onClick={() => {handleAuthorDeleteClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li> authorAddress === account?.signer.address ? (
<>
<li onClick={() => handleAuthorEditClick(reply)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(reply)}>Delete post</li>
</> </>
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -1184,6 +1190,8 @@ const Subscriptions = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(replyMediaInfo && ( {(replyMediaInfo && (
replyMediaInfo.type === 'image' || replyMediaInfo.type === 'image' ||
(replyMediaInfo.type === 'webpage' && (replyMediaInfo.type === 'webpage' &&
@@ -564,8 +564,10 @@ const SubscriptionsCatalog = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li> <li onClick={() => handleOptionClick(thread.cid)}>Hide thread</li>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( <>
{authorAddress === account?.author.address ||
authorAddress === account?.signer.address ? (
<> <>
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li> <li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li> <li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
@@ -573,8 +575,8 @@ const SubscriptionsCatalog = () => {
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={thread.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -598,6 +600,8 @@ const SubscriptionsCatalog = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
(commentMediaInfo.type === 'webpage' && (commentMediaInfo.type === 'webpage' &&
+16 -8
View File
@@ -1024,8 +1024,10 @@ const Thread = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(comment.cid)}>Hide thread</li> <li onClick={() => handleOptionClick(comment.cid)}>Hide thread</li>
{<VerifiedAuthor commentCid={comment.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={comment.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={comment.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( <>
{authorAddress === account?.author.address ||
authorAddress === account?.signer.address ? (
<> <>
<li onClick={() => handleAuthorEditClick(comment)}>Edit post</li> <li onClick={() => handleAuthorEditClick(comment)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(comment)}>Delete post</li> <li onClick={() => handleAuthorDeleteClick(comment)}>Delete post</li>
@@ -1033,8 +1035,8 @@ const Thread = () => {
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={comment.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={comment.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -1056,6 +1058,8 @@ const Thread = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(commentMediaInfo && ( {(commentMediaInfo && (
commentMediaInfo.type === 'image' || commentMediaInfo.type === 'image' ||
(commentMediaInfo.type === 'webpage' && (commentMediaInfo.type === 'webpage' &&
@@ -1272,8 +1276,10 @@ const Thread = () => {
> >
<ul className="post-menu-catalog"> <ul className="post-menu-catalog">
<li onClick={() => handleOptionClick(reply.cid)}>Hide post</li> <li onClick={() => handleOptionClick(reply.cid)}>Hide post</li>
{<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || <VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (
<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( <>
{authorAddress === account?.author.address ||
authorAddress === account?.signer.address ? (
<> <>
<li onClick={() => handleAuthorEditClick(reply)}>Edit post</li> <li onClick={() => handleAuthorEditClick(reply)}>Edit post</li>
<li onClick={() => handleAuthorDeleteClick(reply)}>Delete post</li> <li onClick={() => handleAuthorDeleteClick(reply)}>Delete post</li>
@@ -1281,8 +1287,8 @@ const Thread = () => {
) : null} ) : null}
{isModerator ? ( {isModerator ? (
<> <>
{<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.author.address || {authorAddress === account?.author.address ||
<VerifiedAuthor commentCid={reply.cid}>{({ authorAddress }) => (authorAddress)}</VerifiedAuthor> === account?.signer.address ? ( authorAddress === account?.signer.address ? (
null null
) : ( ) : (
<li onClick={() => { <li onClick={() => {
@@ -1304,6 +1310,8 @@ const Thread = () => {
</li> </li>
</> </>
) : null} ) : null}
</>
)}</VerifiedAuthor>
{(replyMediaInfo && ( {(replyMediaInfo && (
replyMediaInfo.type === 'image' || replyMediaInfo.type === 'image' ||
(replyMediaInfo.type === 'webpage' && (replyMediaInfo.type === 'webpage' &&