mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix error messages, comment edits, ENS discrepancy
This commit is contained in:
@@ -50,7 +50,8 @@ const ModerationModal = ({ isOpen, closeModal, deletePost }) => {
|
|||||||
if (challengeVerification.challengeSuccess === true) {
|
if (challengeVerification.challengeSuccess === true) {
|
||||||
setNewSuccessMessage('Challenge Success');
|
setNewSuccessMessage('Challenge Success');
|
||||||
} else if (challengeVerification.challengeSuccess === false) {
|
} else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('Challenge Failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -118,6 +119,16 @@ const ModerationModal = ({ isOpen, closeModal, deletePost }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedAddress) {
|
||||||
|
setPublishCommentEditOptions((prevOptions) => ({
|
||||||
|
...prevOptions,
|
||||||
|
subplebbitAddress: selectedAddress,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}, [selectedAddress]);
|
||||||
|
|
||||||
|
|
||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,8 @@ const ReplyModal = ({ isOpen, closeModal }) => {
|
|||||||
console.log('challenge success');
|
console.log('challenge success');
|
||||||
}
|
}
|
||||||
else if (challengeVerification.challengeSuccess === false) {
|
else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('challenge failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,8 @@ const All = () => {
|
|||||||
setNewSuccessMessage('Challenge Success');
|
setNewSuccessMessage('Challenge Success');
|
||||||
}
|
}
|
||||||
else if (challengeVerification.challengeSuccess === false) {
|
else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('Challenge Failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -363,8 +364,8 @@ const All = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (cid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(cid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -378,9 +379,10 @@ const All = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(cid);
|
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
|
commentCid: comment.cid,
|
||||||
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}));
|
}));
|
||||||
setTriggerPublishCommentEdit(true);
|
setTriggerPublishCommentEdit(true);
|
||||||
@@ -776,15 +778,17 @@ 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>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li>
|
<li onClick={() => {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li>
|
||||||
<li onClick={() => {handleAuthorDeleteClick(thread.cid); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li>
|
<li onClick={() => {handleAuthorDeleteClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
@@ -1064,15 +1068,17 @@ 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>
|
||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.address === account?.author.address ||
|
||||||
|
reply.author.address === account?.signer.address ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li>
|
<li onClick={() => {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li>
|
||||||
<li onClick={() => {handleAuthorDeleteClick(reply.cid); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li>
|
<li onClick={() => {handleAuthorDeleteClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.address === account?.author.address ||
|
||||||
|
reply.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ const AllCatalog = () => {
|
|||||||
setNewSuccessMessage('Challenge Success');
|
setNewSuccessMessage('Challenge Success');
|
||||||
}
|
}
|
||||||
else if (challengeVerification.challengeSuccess === false) {
|
else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('Challenge Failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -232,9 +233,10 @@ const AllCatalog = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(comment.cid);
|
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
|
commentCid: comment.cid,
|
||||||
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}));
|
}));
|
||||||
setTriggerPublishCommentEdit(true);
|
setTriggerPublishCommentEdit(true);
|
||||||
@@ -557,7 +559,8 @@ 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>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === 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>
|
||||||
@@ -565,7 +568,8 @@ const AllCatalog = () => {
|
|||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
|
|||||||
@@ -310,7 +310,8 @@ const Board = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (challengeVerification.challengeSuccess === false) {
|
else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('Challenge Failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -505,8 +506,8 @@ const Board = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (cid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(cid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -520,9 +521,10 @@ const Board = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(cid);
|
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
|
commentCid: comment.cid,
|
||||||
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}));
|
}));
|
||||||
setTriggerPublishCommentEdit(true);
|
setTriggerPublishCommentEdit(true);
|
||||||
@@ -838,7 +840,7 @@ const Board = () => {
|
|||||||
{subplebbit?.state === "failed" ? (
|
{subplebbit?.state === "failed" ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
subplebbit?.state === "succeeded" ? (
|
feed.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
{subplebbit.rules ?
|
{subplebbit.rules ?
|
||||||
<>
|
<>
|
||||||
@@ -1421,15 +1423,17 @@ 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>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
|
<li onClick={() => handleAuthorEditClick(thread)}>Edit post</li>
|
||||||
<li onClick={() => handleAuthorDeleteClick(thread.cid)}>Delete post</li>
|
<li onClick={() => handleAuthorDeleteClick(thread)}>Delete post</li>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
@@ -1702,15 +1706,17 @@ 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>
|
||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.address === account?.author.address ||
|
||||||
|
reply.author.address === account?.signer.address ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => handleAuthorEditClick(reply)}>Edit post</li>
|
<li onClick={() => handleAuthorEditClick(reply)}>Edit post</li>
|
||||||
<li onClick={() => handleAuthorDeleteClick(reply.cid)}>Delete post</li>
|
<li onClick={() => handleAuthorDeleteClick(reply)}>Delete post</li>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.address === account?.author.address ||
|
||||||
|
reply.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
|
|||||||
@@ -195,7 +195,8 @@ const Catalog = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (challengeVerification.challengeSuccess === false) {
|
else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('Challenge Failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -404,9 +405,10 @@ const Catalog = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(comment.cid);
|
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
|
commentCid: comment.cid,
|
||||||
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}));
|
}));
|
||||||
setTriggerPublishCommentEdit(true);
|
setTriggerPublishCommentEdit(true);
|
||||||
@@ -1005,7 +1007,8 @@ 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>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === 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>
|
||||||
@@ -1013,7 +1016,8 @@ const Catalog = () => {
|
|||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
|
|||||||
@@ -288,7 +288,8 @@ const Subscriptions = () => {
|
|||||||
setNewSuccessMessage('Challenge Success');
|
setNewSuccessMessage('Challenge Success');
|
||||||
}
|
}
|
||||||
else if (challengeVerification.challengeSuccess === false) {
|
else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('Challenge Failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -364,8 +365,8 @@ const Subscriptions = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (cid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(cid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -379,9 +380,10 @@ const Subscriptions = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(cid);
|
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
|
commentCid: comment.cid,
|
||||||
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}));
|
}));
|
||||||
setTriggerPublishCommentEdit(true);
|
setTriggerPublishCommentEdit(true);
|
||||||
@@ -786,15 +788,17 @@ 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>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li>
|
<li onClick={() => {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li>
|
||||||
<li onClick={() => {handleAuthorDeleteClick(thread.cid); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li>
|
<li onClick={() => {handleAuthorDeleteClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
@@ -1074,15 +1078,17 @@ 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>
|
||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.address === account?.author.address ||
|
||||||
|
reply.author.address === account?.signer.address ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li>
|
<li onClick={() => {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post</li>
|
||||||
<li onClick={() => {handleAuthorDeleteClick(reply.cid); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li>
|
<li onClick={() => {handleAuthorDeleteClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Delete post</li>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.address === account?.author.address ||
|
||||||
|
reply.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
|
|||||||
@@ -146,7 +146,8 @@ const SubscriptionsCatalog = () => {
|
|||||||
setNewSuccessMessage('Challenge Success');
|
setNewSuccessMessage('Challenge Success');
|
||||||
}
|
}
|
||||||
else if (challengeVerification.challengeSuccess === false) {
|
else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('Challenge Failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -229,9 +230,10 @@ const SubscriptionsCatalog = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(comment.cid);
|
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
|
commentCid: comment.cid,
|
||||||
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}));
|
}));
|
||||||
setTriggerPublishCommentEdit(true);
|
setTriggerPublishCommentEdit(true);
|
||||||
@@ -561,7 +563,8 @@ 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>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === 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,7 +572,8 @@ const SubscriptionsCatalog = () => {
|
|||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.address === account?.author.address ||
|
||||||
|
thread.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
|
|||||||
@@ -267,7 +267,8 @@ const Thread = () => {
|
|||||||
setNewSuccessMessage('Challenge Success');
|
setNewSuccessMessage('Challenge Success');
|
||||||
}
|
}
|
||||||
} else if (challengeVerification.challengeSuccess === false) {
|
} else if (challengeVerification.challengeSuccess === false) {
|
||||||
setNewErrorMessage('Challenge Failed', {reason: challengeVerification.reason, errors: challengeVerification.errors});
|
setNewErrorMessage(`Challenge Failed, reason: ${challengeVerification.reason}. Errors: ${challengeVerification.errors}`);
|
||||||
|
console.log('challenge failed', challengeVerification);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -462,8 +463,8 @@ const Thread = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (cid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(cid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -477,9 +478,10 @@ const Thread = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(cid);
|
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
|
commentCid: comment.cid,
|
||||||
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
}));
|
}));
|
||||||
setTriggerPublishCommentEdit(true);
|
setTriggerPublishCommentEdit(true);
|
||||||
@@ -948,15 +950,17 @@ 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>
|
||||||
{comment.author?.shortAddress === account?.author.shortAddress ? (
|
{comment.author.address === account?.author.address ||
|
||||||
|
comment.author.address === account?.signer.address ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => handleAuthorEditClick(comment)}>Edit post</li>
|
<li onClick={() => handleAuthorEditClick(comment)}>Edit post</li>
|
||||||
<li onClick={() => handleAuthorDeleteClick(comment.cid)}>Delete post</li>
|
<li onClick={() => handleAuthorDeleteClick(comment)}>Delete post</li>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{comment.author?.shortAddress === account?.author.shortAddress ? (
|
{comment.author.address === account?.author.address ||
|
||||||
|
comment.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
@@ -1194,15 +1198,17 @@ 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>
|
||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.address === account?.author.address ||
|
||||||
|
reply.author.address === account?.signer.address ? (
|
||||||
<>
|
<>
|
||||||
<li onClick={() => handleAuthorEditClick(reply)}>Edit post</li>
|
<li onClick={() => handleAuthorEditClick(reply)}>Edit post</li>
|
||||||
<li onClick={() => handleAuthorDeleteClick(reply.cid)}>Delete post</li>
|
<li onClick={() => handleAuthorDeleteClick(reply)}>Delete post</li>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
{isModerator ? (
|
{isModerator ? (
|
||||||
<>
|
<>
|
||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.address === account?.author.address ||
|
||||||
|
reply.author.address === account?.signer.address ? (
|
||||||
null
|
null
|
||||||
) : (
|
) : (
|
||||||
<li onClick={() => {
|
<li onClick={() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user