mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(edit menu): mod and author edits were conflicting
This commit is contained in:
@@ -42,25 +42,25 @@ const EditMenu = ({ commentCid, isAccountMod, isAccountCommentAuthor, isCommentA
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const defaultPublishOptions: PublishCommentEditOptions = {
|
const defaultPublishEditOptions: PublishCommentEditOptions = {
|
||||||
commentAuthor: { banExpiresAt },
|
commentAuthor: isAccountMod && !isAccountCommentAuthor && banExpiresAt !== undefined ? { banExpiresAt } : undefined,
|
||||||
commentCid,
|
commentCid,
|
||||||
content,
|
content: isAccountCommentAuthor ? content : undefined,
|
||||||
deleted,
|
deleted: isAccountCommentAuthor ? deleted : undefined,
|
||||||
locked,
|
locked: isAccountMod ? locked : undefined,
|
||||||
pinned,
|
pinned: isAccountMod ? pinned : undefined,
|
||||||
removed,
|
removed: isAccountMod ? removed : undefined,
|
||||||
spoiler,
|
spoiler,
|
||||||
subplebbitAddress,
|
subplebbitAddress,
|
||||||
onChallenge: (...args: any) => addChallenge([...args, post]),
|
onChallenge: (...args: any) => addChallenge([...args, post]),
|
||||||
onChallengeVerification: alertChallengeVerificationFailed,
|
onChallengeVerification: alertChallengeVerificationFailed,
|
||||||
onError: (error: Error) => {
|
onError: (error: Error) => {
|
||||||
console.warn(error);
|
console.warn(error);
|
||||||
alert(error.message);
|
alert('Comment edit failed. ' + error.message);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [publishCommentEditOptions, setPublishCommentEditOptions] = useState(defaultPublishOptions);
|
const [publishCommentEditOptions, setPublishCommentEditOptions] = useState(defaultPublishEditOptions);
|
||||||
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
const { publishCommentEdit } = usePublishCommentEdit(publishCommentEditOptions);
|
||||||
|
|
||||||
const [banDuration, setBanDuration] = useState(1);
|
const [banDuration, setBanDuration] = useState(1);
|
||||||
@@ -112,6 +112,7 @@ const EditMenu = ({ commentCid, isAccountMod, isAccountCommentAuthor, isCommentA
|
|||||||
const headingId = useId();
|
const headingId = useId();
|
||||||
|
|
||||||
const _publishCommentEdit = async () => {
|
const _publishCommentEdit = async () => {
|
||||||
|
console.log('publishCommentEditOptions', publishCommentEditOptions);
|
||||||
try {
|
try {
|
||||||
await publishCommentEdit();
|
await publishCommentEdit();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user