mirror of
https://github.com/plebbit/seedit.git
synced 2026-04-30 20:17:09 -04:00
feat(reply form): allow posting replies with a link and no content
This commit is contained in:
@@ -47,8 +47,8 @@ const ReplyForm = ({ cid, isReplyingToReply, hideReplyForm }: ReplyFormProps) =>
|
||||
const currentContent = textRef.current?.value || '';
|
||||
const currentUrl = urlRef.current?.value || '';
|
||||
|
||||
if (!currentContent.trim()) {
|
||||
alert(`missing content`);
|
||||
if (!currentContent.trim() && !currentUrl) {
|
||||
alert(`missing content or url`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,30 @@ const useReply = (comment: Comment) => {
|
||||
|
||||
const setContent = useMemo(
|
||||
() => ({
|
||||
content: (newContent: string) => setReplyStore({ subplebbitAddress, parentCid, content: newContent, link: link || undefined, spoiler: spoiler || false }),
|
||||
link: (newLink: string) => setReplyStore({ subplebbitAddress, parentCid, content: content, link: newLink || undefined, spoiler: spoiler || false }),
|
||||
spoiler: (newSpoiler: boolean) => setReplyStore({ subplebbitAddress, parentCid, content: content, link: link || undefined, spoiler: newSpoiler }),
|
||||
content: (newContent: string) =>
|
||||
setReplyStore({
|
||||
subplebbitAddress,
|
||||
parentCid,
|
||||
content: newContent === '' ? undefined : newContent,
|
||||
link: link || undefined,
|
||||
spoiler: spoiler || false,
|
||||
}),
|
||||
link: (newLink: string) =>
|
||||
setReplyStore({
|
||||
subplebbitAddress,
|
||||
parentCid,
|
||||
content: content,
|
||||
link: newLink || undefined,
|
||||
spoiler: spoiler || false,
|
||||
}),
|
||||
spoiler: (newSpoiler: boolean) =>
|
||||
setReplyStore({
|
||||
subplebbitAddress,
|
||||
parentCid,
|
||||
content: content,
|
||||
link: link || undefined,
|
||||
spoiler: newSpoiler,
|
||||
}),
|
||||
}),
|
||||
[subplebbitAddress, parentCid, setReplyStore, content, link, spoiler],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user