fix(post form): default link label to 'link to file' on /all/ and /subs/

This commit is contained in:
plebeius
2026-03-01 15:27:27 +08:00
parent 5a643d8cbc
commit 2bc2827f83
2 changed files with 8 additions and 5 deletions
+2 -1
View File
@@ -324,7 +324,8 @@ 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 requirePostLinkIsMediaFeature = directoryEntry?.features?.requirePostLinkIsMedia;
const requirePostLinkIsMedia = requirePostLinkIsMediaFeature === true || (requirePostLinkIsMediaFeature === undefined && (isInAllView || isInSubscriptionsView));
const { accountSubplebbits } = useAccountSubplebbits();
const accountSubplebbitAddresses = Object.keys(accountSubplebbits);
+6 -4
View File
@@ -35,9 +35,14 @@ interface ReplyModalProps {
const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, threadNumber, postCid, scrollY, subplebbitAddress }: ReplyModalProps) => {
const { t } = useTranslation();
const location = useLocation();
const params = useParams();
const isInAllView = isAllView(location.pathname);
const isInSubscriptionsView = isSubscriptionsView(location.pathname, params);
const directoryEntry = useDirectoryByAddress(subplebbitAddress);
const showSpoilerForReply = directoryEntry?.features?.noSpoilerReplies !== true;
const requirePostLinkIsMedia = directoryEntry?.features?.requirePostLinkIsMedia === true;
const requirePostLinkIsMediaFeature = directoryEntry?.features?.requirePostLinkIsMedia;
const requirePostLinkIsMedia = requirePostLinkIsMediaFeature === true || (requirePostLinkIsMediaFeature === undefined && (isInAllView || isInSubscriptionsView));
const { setPublishReplyOptions, publishReply, resetPublishReplyOptions, replyIndex } = usePublishReply({
cid: parentCid,
subplebbitAddress,
@@ -148,9 +153,6 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, threa
}
}, [parentCid]);
const location = useLocation();
const isInAllView = isAllView(location.pathname);
const isInSubscriptionsView = isSubscriptionsView(location.pathname, useParams());
const currentTime = useCurrentTime();
// Only subscribe to updatedAt to avoid rerenders from updatingState changes
const updatedAt = useSubplebbitField(subplebbitAddress, (subplebbit) => subplebbit?.updatedAt);