diff --git a/src/components/modals/ModerationModal.jsx b/src/components/modals/ModerationModal.jsx
index 296b74bc..9188516a 100755
--- a/src/components/modals/ModerationModal.jsx
+++ b/src/components/modals/ModerationModal.jsx
@@ -50,7 +50,8 @@ const ModerationModal = ({ isOpen, closeModal, deletePost }) => {
if (challengeVerification.challengeSuccess === true) {
setNewSuccessMessage('Challenge Success');
} 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);
}
};
@@ -116,6 +117,16 @@ const ModerationModal = ({ isOpen, closeModal, deletePost }) => {
setNewErrorMessage(error.message); console.log(error);
},
});
+
+
+ useEffect(() => {
+ if (selectedAddress) {
+ setPublishCommentEditOptions((prevOptions) => ({
+ ...prevOptions,
+ subplebbitAddress: selectedAddress,
+ }));
+ }
+ }, [selectedAddress]);
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
diff --git a/src/components/modals/ReplyModal.jsx b/src/components/modals/ReplyModal.jsx
index e185ebac..15edc674 100755
--- a/src/components/modals/ReplyModal.jsx
+++ b/src/components/modals/ReplyModal.jsx
@@ -102,7 +102,8 @@ const ReplyModal = ({ isOpen, closeModal }) => {
console.log('challenge success');
}
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);
}
};
diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx
index 5a7dea04..e4ff28d1 100755
--- a/src/components/views/All.jsx
+++ b/src/components/views/All.jsx
@@ -287,7 +287,8 @@ const All = () => {
setNewSuccessMessage('Challenge Success');
}
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 handleAuthorDeleteClick = (cid) => {
- handleOptionClick(cid);
+ const handleAuthorDeleteClick = (comment) => {
+ handleOptionClick(comment.cid);
confirmAlert({
customUI: ({ onClose }) => {
@@ -378,9 +379,10 @@ const All = () => {
onClick={() => {
setIsAuthorDelete(true);
setIsAuthorEdit(false);
- setCommentCid(cid);
setPublishCommentEditOptions(prevOptions => ({
...prevOptions,
+ commentCid: comment.cid,
+ subplebbitAddress: comment.subplebbitAddress,
deleted: true,
}));
setTriggerPublishCommentEdit(true);
@@ -776,15 +778,17 @@ const All = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
<>
- {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post
- - {handleAuthorDeleteClick(thread.cid); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
+ - {handleAuthorDeleteClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
>
) : null}
{isModerator ? (
<>
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
null
) : (
- {
@@ -1064,15 +1068,17 @@ const All = () => {
>
- handleOptionClick(reply.cid)}>Hide post
- {reply.author.shortAddress === account?.author.shortAddress ? (
+ {reply.author.address === account?.author.address ||
+ reply.author.address === account?.signer.address ? (
<>
- {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post
- - {handleAuthorDeleteClick(reply.cid); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
+ - {handleAuthorDeleteClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
>
) : null}
{isModerator ? (
<>
- {reply.author.shortAddress === account?.author.shortAddress ? (
+ {reply.author.address === account?.author.address ||
+ reply.author.address === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/AllCatalog.jsx b/src/components/views/AllCatalog.jsx
index 515b1104..028000d9 100755
--- a/src/components/views/AllCatalog.jsx
+++ b/src/components/views/AllCatalog.jsx
@@ -149,7 +149,8 @@ const AllCatalog = () => {
setNewSuccessMessage('Challenge Success');
}
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={() => {
setIsAuthorDelete(true);
setIsAuthorEdit(false);
- setCommentCid(comment.cid);
setPublishCommentEditOptions(prevOptions => ({
...prevOptions,
+ commentCid: comment.cid,
+ subplebbitAddress: comment.subplebbitAddress,
deleted: true,
}));
setTriggerPublishCommentEdit(true);
@@ -557,7 +559,8 @@ const AllCatalog = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
<>
- handleAuthorEditClick(thread)}>Edit post
- handleAuthorDeleteClick(thread)}>Delete post
@@ -565,7 +568,8 @@ const AllCatalog = () => {
) : null}
{isModerator ? (
<>
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx
index e6a91ea5..572970d4 100755
--- a/src/components/views/Board.jsx
+++ b/src/components/views/Board.jsx
@@ -310,7 +310,8 @@ const Board = () => {
}
}
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 handleAuthorDeleteClick = (cid) => {
- handleOptionClick(cid);
+ const handleAuthorDeleteClick = (comment) => {
+ handleOptionClick(comment.cid);
confirmAlert({
customUI: ({ onClose }) => {
@@ -520,9 +521,10 @@ const Board = () => {
onClick={() => {
setIsAuthorDelete(true);
setIsAuthorEdit(false);
- setCommentCid(cid);
setPublishCommentEditOptions(prevOptions => ({
...prevOptions,
+ commentCid: comment.cid,
+ subplebbitAddress: comment.subplebbitAddress,
deleted: true,
}));
setTriggerPublishCommentEdit(true);
@@ -838,7 +840,7 @@ const Board = () => {
{subplebbit?.state === "failed" ? (
null
) : (
- subplebbit?.state === "succeeded" ? (
+ feed.length > 0 ? (
<>
{subplebbit.rules ?
<>
@@ -1421,15 +1423,17 @@ const Board = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
<>
- handleAuthorEditClick(thread)}>Edit post
- - handleAuthorDeleteClick(thread.cid)}>Delete post
+ - handleAuthorDeleteClick(thread)}>Delete post
>
) : null}
{isModerator ? (
<>
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
null
) : (
- {
@@ -1702,15 +1706,17 @@ const Board = () => {
>
- handleOptionClick(reply.cid)}>Hide post
- {reply.author.shortAddress === account?.author.shortAddress ? (
+ {reply.author.address === account?.author.address ||
+ reply.author.address === account?.signer.address ? (
<>
- handleAuthorEditClick(reply)}>Edit post
- - handleAuthorDeleteClick(reply.cid)}>Delete post
+ - handleAuthorDeleteClick(reply)}>Delete post
>
) : null}
{isModerator ? (
<>
- {reply.author.shortAddress === account?.author.shortAddress ? (
+ {reply.author.address === account?.author.address ||
+ reply.author.address === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx
index bba78daf..633b6427 100755
--- a/src/components/views/Catalog.jsx
+++ b/src/components/views/Catalog.jsx
@@ -195,7 +195,8 @@ const Catalog = () => {
}
}
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={() => {
setIsAuthorDelete(true);
setIsAuthorEdit(false);
- setCommentCid(comment.cid);
setPublishCommentEditOptions(prevOptions => ({
...prevOptions,
+ commentCid: comment.cid,
+ subplebbitAddress: comment.subplebbitAddress,
deleted: true,
}));
setTriggerPublishCommentEdit(true);
@@ -1005,7 +1007,8 @@ const Catalog = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
<>
- handleAuthorEditClick(thread)}>Edit post
- handleAuthorDeleteClick(thread)}>Delete post
@@ -1013,7 +1016,8 @@ const Catalog = () => {
) : null}
{isModerator ? (
<>
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/Subscriptions.jsx b/src/components/views/Subscriptions.jsx
index c093a71d..8aff1a0c 100755
--- a/src/components/views/Subscriptions.jsx
+++ b/src/components/views/Subscriptions.jsx
@@ -288,7 +288,8 @@ const Subscriptions = () => {
setNewSuccessMessage('Challenge Success');
}
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 handleAuthorDeleteClick = (cid) => {
- handleOptionClick(cid);
+ const handleAuthorDeleteClick = (comment) => {
+ handleOptionClick(comment.cid);
confirmAlert({
customUI: ({ onClose }) => {
@@ -379,9 +380,10 @@ const Subscriptions = () => {
onClick={() => {
setIsAuthorDelete(true);
setIsAuthorEdit(false);
- setCommentCid(cid);
setPublishCommentEditOptions(prevOptions => ({
...prevOptions,
+ commentCid: comment.cid,
+ subplebbitAddress: comment.subplebbitAddress,
deleted: true,
}));
setTriggerPublishCommentEdit(true);
@@ -786,15 +788,17 @@ const Subscriptions = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
<>
- {handleAuthorEditClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Edit post
- - {handleAuthorDeleteClick(thread.cid); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
+ - {handleAuthorDeleteClick(thread); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
>
) : null}
{isModerator ? (
<>
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
null
) : (
- {
@@ -1074,15 +1078,17 @@ const Subscriptions = () => {
>
- handleOptionClick(reply.cid)}>Hide post
- {reply.author.shortAddress === account?.author.shortAddress ? (
+ {reply.author.address === account?.author.address ||
+ reply.author.address === account?.signer.address ? (
<>
- {handleAuthorEditClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Edit post
- - {handleAuthorDeleteClick(reply.cid); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
+ - {handleAuthorDeleteClick(reply); setSelectedAddress(thread.subplebbitAddress);}}>Delete post
>
) : null}
{isModerator ? (
<>
- {reply.author.shortAddress === account?.author.shortAddress ? (
+ {reply.author.address === account?.author.address ||
+ reply.author.address === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/SubscriptionsCatalog.jsx b/src/components/views/SubscriptionsCatalog.jsx
index 7bbb5a3c..037debc3 100755
--- a/src/components/views/SubscriptionsCatalog.jsx
+++ b/src/components/views/SubscriptionsCatalog.jsx
@@ -146,7 +146,8 @@ const SubscriptionsCatalog = () => {
setNewSuccessMessage('Challenge Success');
}
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={() => {
setIsAuthorDelete(true);
setIsAuthorEdit(false);
- setCommentCid(comment.cid);
setPublishCommentEditOptions(prevOptions => ({
...prevOptions,
+ commentCid: comment.cid,
+ subplebbitAddress: comment.subplebbitAddress,
deleted: true,
}));
setTriggerPublishCommentEdit(true);
@@ -561,7 +563,8 @@ const SubscriptionsCatalog = () => {
>
- handleOptionClick(thread.cid)}>Hide thread
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
<>
- handleAuthorEditClick(thread)}>Edit post
- handleAuthorDeleteClick(thread)}>Delete post
@@ -569,7 +572,8 @@ const SubscriptionsCatalog = () => {
) : null}
{isModerator ? (
<>
- {thread.author.shortAddress === account?.author.shortAddress ? (
+ {thread.author.address === account?.author.address ||
+ thread.author.address === account?.signer.address ? (
null
) : (
- {
diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx
index 708a73e0..bd3a2f17 100755
--- a/src/components/views/Thread.jsx
+++ b/src/components/views/Thread.jsx
@@ -267,7 +267,8 @@ const Thread = () => {
setNewSuccessMessage('Challenge Success');
}
} 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 handleAuthorDeleteClick = (cid) => {
- handleOptionClick(cid);
+ const handleAuthorDeleteClick = (comment) => {
+ handleOptionClick(comment.cid);
confirmAlert({
customUI: ({ onClose }) => {
@@ -477,9 +478,10 @@ const Thread = () => {
onClick={() => {
setIsAuthorDelete(true);
setIsAuthorEdit(false);
- setCommentCid(cid);
setPublishCommentEditOptions(prevOptions => ({
...prevOptions,
+ commentCid: comment.cid,
+ subplebbitAddress: comment.subplebbitAddress,
deleted: true,
}));
setTriggerPublishCommentEdit(true);
@@ -948,15 +950,17 @@ const Thread = () => {
>
- handleOptionClick(comment.cid)}>Hide thread
- {comment.author?.shortAddress === account?.author.shortAddress ? (
+ {comment.author.address === account?.author.address ||
+ comment.author.address === account?.signer.address ? (
<>
- handleAuthorEditClick(comment)}>Edit post
- - handleAuthorDeleteClick(comment.cid)}>Delete post
+ - handleAuthorDeleteClick(comment)}>Delete post
>
) : null}
{isModerator ? (
<>
- {comment.author?.shortAddress === account?.author.shortAddress ? (
+ {comment.author.address === account?.author.address ||
+ comment.author.address === account?.signer.address ? (
null
) : (
- {
@@ -1194,15 +1198,17 @@ const Thread = () => {
>
- handleOptionClick(reply.cid)}>Hide post
- {reply.author.shortAddress === account?.author.shortAddress ? (
+ {reply.author.address === account?.author.address ||
+ reply.author.address === account?.signer.address ? (
<>
- handleAuthorEditClick(reply)}>Edit post
- - handleAuthorDeleteClick(reply.cid)}>Delete post
+ - handleAuthorDeleteClick(reply)}>Delete post
>
) : null}
{isModerator ? (
<>
- {reply.author.shortAddress === account?.author.shortAddress ? (
+ {reply.author.address === account?.author.address ||
+ reply.author.address === account?.signer.address ? (
null
) : (
- {