mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(post-form): show 'Link To File' when requirePostLinkIsMedia is true
This commit is contained in:
@@ -115,6 +115,7 @@ interface PostFormFieldsProps {
|
||||
accountSubplebbitAddresses: string[];
|
||||
subscriptions: string[];
|
||||
subplebbitAddress: string | undefined;
|
||||
requirePostLinkIsMedia: boolean;
|
||||
onPublishReply: () => void;
|
||||
onPublishPost: () => void;
|
||||
handleUpload: () => void;
|
||||
@@ -146,6 +147,7 @@ const PostFormFields = ({
|
||||
accountSubplebbitAddresses,
|
||||
subscriptions,
|
||||
subplebbitAddress,
|
||||
requirePostLinkIsMedia,
|
||||
onPublishReply,
|
||||
onPublishPost,
|
||||
handleUpload,
|
||||
@@ -212,7 +214,7 @@ const PostFormFields = ({
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{t('link')}</td>
|
||||
<td>{requirePostLinkIsMedia ? t('link_to_file') : t('link')}</td>
|
||||
<td className={styles.linkField}>
|
||||
<input
|
||||
type='text'
|
||||
@@ -322,6 +324,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
|
||||
const directoryEntry = useDirectoryByAddress(effectiveBoardAddress);
|
||||
const showSpoilerForPost = directoryEntry?.features?.noSpoilers !== true;
|
||||
const showSpoilerForReply = directoryEntry?.features?.noSpoilerReplies !== true;
|
||||
const requirePostLinkIsMedia = directoryEntry?.features?.requirePostLinkIsMedia === true;
|
||||
|
||||
const { accountSubplebbits } = useAccountSubplebbits();
|
||||
const accountSubplebbitAddresses = Object.keys(accountSubplebbits);
|
||||
@@ -502,6 +505,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
|
||||
accountSubplebbitAddresses={accountSubplebbitAddresses}
|
||||
subscriptions={subscriptions}
|
||||
subplebbitAddress={subplebbitAddress}
|
||||
requirePostLinkIsMedia={requirePostLinkIsMedia}
|
||||
onPublishReply={onPublishReply}
|
||||
onPublishPost={onPublishPost}
|
||||
handleUpload={handleUpload}
|
||||
|
||||
@@ -37,6 +37,7 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, threa
|
||||
const { t } = useTranslation();
|
||||
const directoryEntry = useDirectoryByAddress(subplebbitAddress);
|
||||
const showSpoilerForReply = directoryEntry?.features?.noSpoilerReplies !== true;
|
||||
const requirePostLinkIsMedia = directoryEntry?.features?.requirePostLinkIsMedia === true;
|
||||
const { setPublishReplyOptions, publishReply, resetPublishReplyOptions, replyIndex } = usePublishReply({
|
||||
cid: parentCid,
|
||||
subplebbitAddress,
|
||||
@@ -322,7 +323,13 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, threa
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.link}>
|
||||
<input type='text' ref={urlRef} placeholder={capitalize(t('link'))} disabled={isUploading} onChange={(e) => setPublishReplyOptions({ link: e.target.value })} />
|
||||
<input
|
||||
type='text'
|
||||
ref={urlRef}
|
||||
placeholder={capitalize(requirePostLinkIsMedia ? t('link_to_file') : t('link'))}
|
||||
disabled={isUploading}
|
||||
onChange={(e) => setPublishReplyOptions({ link: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.content}>
|
||||
<textarea
|
||||
|
||||
Reference in New Issue
Block a user