diff --git a/src/common/components/CastRow.tsx b/src/common/components/CastRow.tsx index 9bf8da43..79343e95 100644 --- a/src/common/components/CastRow.tsx +++ b/src/common/components/CastRow.tsx @@ -29,7 +29,7 @@ interface CastRowProps { } export const CastRow = ({ cast, isSelected, showChannel, onSelect, channels, showEmbed, isThreadView = false }: CastRowProps) => { - if (isSelected) console.log(cast); + // if (isSelected) console.log(cast); const { accounts, selectedAccountIdx } = useAccountStore(); const [didLike, setDidLike] = useState(false) diff --git a/src/common/components/CastThreadView.tsx b/src/common/components/CastThreadView.tsx index d66a59dd..28df300c 100644 --- a/src/common/components/CastThreadView.tsx +++ b/src/common/components/CastThreadView.tsx @@ -70,7 +70,7 @@ export const CastThreadView = ({ cast, onBack, fid, isActive }: CastThreadViewPr addNewPostDraft({ parentCastId: { hash: cast.hash, fid: cast.author.fid } }) return () => { - console.log('exit thread view') + // console.log('exit thread view') removePostDraft(draftIdx, true) } }, [cast.hash]) diff --git a/src/common/components/FarcasterLogin.tsx b/src/common/components/FarcasterLogin.tsx index 4f9af18f..85bf54f0 100644 --- a/src/common/components/FarcasterLogin.tsx +++ b/src/common/components/FarcasterLogin.tsx @@ -80,7 +80,7 @@ const FarcasterLogin = () => { }, [runPolling]) const onCreateNewAccount = async () => { - console.log('onCreateNewAccount', accountName); + // console.log('onCreateNewAccount', accountName); if (!accountName) { setErrorMessage('Account name is required'); return; @@ -89,7 +89,7 @@ const FarcasterLogin = () => { setIsLoading(true); const { publicKey, privateKey, token, deeplinkUrl } = await generateWarpcastSigner(); - console.log('onCreateNewAccount', publicKey, token, deeplinkUrl); + // console.log('onCreateNewAccount', publicKey, token, deeplinkUrl); try { addAccount({ diff --git a/src/common/helpers/farcaster.ts b/src/common/helpers/farcaster.ts index 9113b56a..40c401f1 100644 --- a/src/common/helpers/farcaster.ts +++ b/src/common/helpers/farcaster.ts @@ -32,6 +32,8 @@ export const convertEditorCastToPublishableCast = async (draft: DraftType): Prom const mentionRegex = /\s?@(\S+)/g; let match; + let idxReducedByPreviousMentions = 0; + while ((match = mentionRegex.exec(text)) != null) { // match contains [@username, username] const casterUsername = match[1]; @@ -47,13 +49,13 @@ export const convertEditorCastToPublishableCast = async (draft: DraftType): Prom console.log(err); continue; } - cast = { ...cast, text: cast.text.replace(match[0], ''), mentions: [...cast.mentions, Number(fid)], - mentionsPositions: [...cast.mentionsPositions, match.index] + mentionsPositions: [...cast.mentionsPositions, match.index - idxReducedByPreviousMentions] } + idxReducedByPreviousMentions += match[0].length; } if (!isEmpty(draft.parentCastId)) { diff --git a/src/stores/useNewPostStore.ts b/src/stores/useNewPostStore.ts index 12abffd4..2450e792 100644 --- a/src/stores/useNewPostStore.ts +++ b/src/stores/useNewPostStore.ts @@ -147,7 +147,7 @@ const store = (set: StoreSet) => ({ try { state.updatePostDraft(draftIdx, { ...draft, status: DraftStatus.publishing }); const castBody = await Promise.resolve(convertEditorCastToPublishableCast(draft)); - // console.log('publishPostdraft castBody', castBody) + console.log('publishPostdraft castBody', castBody) await Promise.resolve( publishCast({ castBody,