mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix displayName
This commit is contained in:
@@ -93,23 +93,22 @@ const useReplyStore = create<ReplyState>((set) => ({
|
||||
|
||||
const useReply = ({ cid, subplebbitAddress }: { cid: string; subplebbitAddress: string }) => {
|
||||
const parentCid = cid;
|
||||
const account = useAccount();
|
||||
const { anonMode } = useAnonMode();
|
||||
|
||||
const { author, signer, content, link, spoiler, publishCommentOptions } = useReplyStore((state) => ({
|
||||
author: state.author[parentCid],
|
||||
displayName: state.displayName[parentCid],
|
||||
author: state.author[parentCid] || (account?.author ? { ...account.author, displayName: account.author.displayName || undefined } : undefined),
|
||||
displayName: state.displayName[parentCid] || account?.author?.displayName,
|
||||
signer: state.signer[parentCid],
|
||||
content: state.content[parentCid],
|
||||
content: state.content[parentCid] || '',
|
||||
link: state.link[parentCid],
|
||||
spoiler: state.spoiler[parentCid],
|
||||
spoiler: state.spoiler[parentCid] || false,
|
||||
publishCommentOptions: state.publishCommentOptions[parentCid],
|
||||
}));
|
||||
|
||||
const { anonMode } = useAnonMode();
|
||||
|
||||
const setReplyStore = useReplyStore((state) => state.setReplyStore);
|
||||
const resetReplyStore = useReplyStore((state) => state.resetReplyStore);
|
||||
|
||||
const account = useAccount();
|
||||
|
||||
const setPublishReplyOptions = useCallback(
|
||||
(options: Partial<SetReplyStoreData>) => {
|
||||
const newOptions: Partial<SetReplyStoreData> = {
|
||||
@@ -118,6 +117,7 @@ const useReply = ({ cid, subplebbitAddress }: { cid: string; subplebbitAddress:
|
||||
content: options.content ?? content,
|
||||
link: options.link ?? link,
|
||||
spoiler: options.spoiler ?? spoiler,
|
||||
displayName: options.displayName ?? author?.displayName ?? account?.author?.displayName,
|
||||
};
|
||||
|
||||
if ('displayName' in options) {
|
||||
|
||||
Reference in New Issue
Block a user