mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(quotes): keep same-thread board previews local
This commit is contained in:
@@ -6,11 +6,9 @@ import usePublishAuthorDomainGuard, { getPublishAuthorDomainErrorMessage } from
|
||||
|
||||
type UsePublishPostOptions = {
|
||||
communityAddress?: string;
|
||||
/** legacy compatibility */
|
||||
subplebbitAddress?: string;
|
||||
};
|
||||
|
||||
const usePublishPost = ({ communityAddress: requestedCommunityAddress, subplebbitAddress }: UsePublishPostOptions) => {
|
||||
const usePublishPost = ({ communityAddress }: UsePublishPostOptions) => {
|
||||
const { author, title, content, link, spoiler, publishCommentOptions } = usePublishPostStore((state) => ({
|
||||
author: state.author,
|
||||
title: state.title || undefined,
|
||||
@@ -30,8 +28,6 @@ const usePublishPost = ({ communityAddress: requestedCommunityAddress, subplebbi
|
||||
await abandonPublishRef.current?.();
|
||||
}, []);
|
||||
|
||||
const communityAddress = requestedCommunityAddress ?? subplebbitAddress;
|
||||
|
||||
const createBaseOptions = useCallback(() => {
|
||||
const baseOptions: Comment = {
|
||||
communityAddress,
|
||||
@@ -60,12 +56,8 @@ const usePublishPost = ({ communityAddress: requestedCommunityAddress, subplebbi
|
||||
{} as Partial<Comment>,
|
||||
);
|
||||
|
||||
const {
|
||||
communityAddress: nextCommunityAddress,
|
||||
subplebbitAddress: legacyCommunityAddress,
|
||||
...restOptions
|
||||
} = sanitizedOptions as Partial<Comment> & { subplebbitAddress?: string };
|
||||
const resolvedCommunityAddress = nextCommunityAddress ?? legacyCommunityAddress ?? baseOptions.communityAddress;
|
||||
const { communityAddress: nextCommunityAddress, ...restOptions } = sanitizedOptions;
|
||||
const resolvedCommunityAddress = nextCommunityAddress ?? baseOptions.communityAddress;
|
||||
const newOptions = {
|
||||
...baseOptions,
|
||||
...restOptions,
|
||||
|
||||
Reference in New Issue
Block a user