mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix comment edits
This commit is contained in:
@@ -316,8 +316,8 @@ const All = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (commentCid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(commentCid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -331,7 +331,7 @@ const All = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(commentCid);
|
setCommentCid(comment.cid);
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
@@ -724,7 +724,7 @@ const All = () => {
|
|||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
@@ -1003,7 +1003,7 @@ const All = () => {
|
|||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
|
|||||||
@@ -216,8 +216,8 @@ const AllCatalog = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (commentCid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(commentCid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -231,7 +231,7 @@ const AllCatalog = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(commentCid);
|
setCommentCid(comment.cid);
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
@@ -552,7 +552,7 @@ const AllCatalog = () => {
|
|||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ const Board = () => {
|
|||||||
const [publishCommentEditOptions, setPublishCommentEditOptions] = useState({
|
const [publishCommentEditOptions, setPublishCommentEditOptions] = useState({
|
||||||
commentCid: commentCid,
|
commentCid: commentCid,
|
||||||
content: editedComment || undefined,
|
content: editedComment || undefined,
|
||||||
subplebbitAddress: selectedAddress || subplebbitAddress,
|
subplebbitAddress: selectedAddress,
|
||||||
onChallenge,
|
onChallenge,
|
||||||
onChallengeVerification,
|
onChallengeVerification,
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
@@ -413,8 +413,8 @@ const Board = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (commentCid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(commentCid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -428,7 +428,7 @@ const Board = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(commentCid);
|
setCommentCid(comment.cid);
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
@@ -909,7 +909,7 @@ const Board = () => {
|
|||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
@@ -1169,7 +1169,7 @@ const Board = () => {
|
|||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
|
|||||||
@@ -336,8 +336,8 @@ const Catalog = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (commentCid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(commentCid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -351,7 +351,7 @@ const Catalog = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(commentCid);
|
setCommentCid(comment.cid);
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
@@ -743,7 +743,7 @@ const Catalog = () => {
|
|||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
|
|||||||
@@ -318,8 +318,8 @@ const Subscriptions = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (commentCid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(commentCid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -333,7 +333,7 @@ const Subscriptions = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(commentCid);
|
setCommentCid(comment.cid);
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
@@ -735,7 +735,7 @@ const Subscriptions = () => {
|
|||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
@@ -1014,7 +1014,7 @@ const Subscriptions = () => {
|
|||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
|
|||||||
@@ -214,8 +214,8 @@ const SubscriptionsCatalog = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (commentCid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(commentCid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -229,7 +229,7 @@ const SubscriptionsCatalog = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(commentCid);
|
setCommentCid(comment.cid);
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
@@ -557,7 +557,7 @@ const SubscriptionsCatalog = () => {
|
|||||||
{thread.author.shortAddress === account?.author.shortAddress ? (
|
{thread.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
|
|||||||
@@ -261,13 +261,13 @@ const Thread = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
||||||
...prevPublishCommentOptions,
|
...prevPublishCommentOptions,
|
||||||
subplebbitAddress: selectedAddress,
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
}));
|
}));
|
||||||
}, [selectedAddress]);
|
}, [comment.subplebbitAddress]);
|
||||||
|
|
||||||
|
|
||||||
const [publishCommentOptions, setPublishCommentOptions] = useState({
|
const [publishCommentOptions, setPublishCommentOptions] = useState({
|
||||||
subplebbitAddress: selectedAddress,
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
onChallenge,
|
onChallenge,
|
||||||
onChallengeVerification,
|
onChallengeVerification,
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
@@ -374,7 +374,7 @@ const Thread = () => {
|
|||||||
const [publishCommentEditOptions, setPublishCommentEditOptions] = useState({
|
const [publishCommentEditOptions, setPublishCommentEditOptions] = useState({
|
||||||
commentCid: commentCid,
|
commentCid: commentCid,
|
||||||
content: editedComment || undefined,
|
content: editedComment || undefined,
|
||||||
subplebbitAddress: selectedAddress,
|
subplebbitAddress: comment.subplebbitAddress,
|
||||||
onChallenge,
|
onChallenge,
|
||||||
onChallengeVerification,
|
onChallengeVerification,
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
@@ -386,8 +386,8 @@ const Thread = () => {
|
|||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
|
|
||||||
const handleAuthorDeleteClick = (commentCid) => {
|
const handleAuthorDeleteClick = (comment) => {
|
||||||
handleOptionClick(commentCid);
|
handleOptionClick(comment.cid);
|
||||||
|
|
||||||
confirmAlert({
|
confirmAlert({
|
||||||
customUI: ({ onClose }) => {
|
customUI: ({ onClose }) => {
|
||||||
@@ -401,7 +401,7 @@ const Thread = () => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsAuthorDelete(true);
|
setIsAuthorDelete(true);
|
||||||
setIsAuthorEdit(false);
|
setIsAuthorEdit(false);
|
||||||
setCommentCid(commentCid);
|
setCommentCid(comment.cid);
|
||||||
setPublishCommentEditOptions(prevOptions => ({
|
setPublishCommentEditOptions(prevOptions => ({
|
||||||
...prevOptions,
|
...prevOptions,
|
||||||
deleted: true,
|
deleted: true,
|
||||||
@@ -864,7 +864,7 @@ const Thread = () => {
|
|||||||
{comment.author?.shortAddress === account?.author.shortAddress ? (
|
{comment.author?.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
@@ -1087,7 +1087,7 @@ const Thread = () => {
|
|||||||
{reply.author.shortAddress === account?.author.shortAddress ? (
|
{reply.author.shortAddress === account?.author.shortAddress ? (
|
||||||
<>
|
<>
|
||||||
<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 ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user