From 81d5ae57850ffde035955d574670525229441b4c Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Mon, 15 Jul 2024 22:43:48 +0700 Subject: [PATCH] Fix issue with wording and invalidation --- src/components/modals/MemeOnReviewModal.tsx | 5 +++-- src/services/datahub/events/subscription.tsx | 3 +-- src/services/datahub/posts/subscription.tsx | 11 ++++------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/components/modals/MemeOnReviewModal.tsx b/src/components/modals/MemeOnReviewModal.tsx index 7f7fdaa1d..196ab7bf3 100644 --- a/src/components/modals/MemeOnReviewModal.tsx +++ b/src/components/modals/MemeOnReviewModal.tsx @@ -20,7 +20,8 @@ export default function MemeOnReviewModal({ enabled: props.isOpen, } ) - const remaining = MIN_MEME_FOR_REVIEW - (count?.unapproved ?? 0) + const sentMeme = (count?.unapproved ?? 0) + (count?.approved ?? 0) + const remaining = MIN_MEME_FOR_REVIEW - sentMeme const description = remaining > 0 @@ -32,7 +33,7 @@ export default function MemeOnReviewModal({ : `${ tokenomics?.socialActionPrice.createCommentPoints } points have been used. We received ${ - count?.unapproved ?? 0 + sentMeme ?? 0 } memes from you! Now we need a bit of time to finish review you as a verified creator.` return ( diff --git a/src/services/datahub/events/subscription.tsx b/src/services/datahub/events/subscription.tsx index 2e2f97122..dfe9ee758 100644 --- a/src/services/datahub/events/subscription.tsx +++ b/src/services/datahub/events/subscription.tsx @@ -235,7 +235,6 @@ async function processSubscriptionEvent( if (eventData.meta.callName === SocialCallName.SynthSetPostApproveStatus) { const extension = eventData.meta.extension - const updatedPostId = extension?.postId ?? '' const creatorAddress = extension?.creatorAddress ?? '' const rootPostId = extension?.rootPostId ?? '' const profile = getProfileQuery.getQueryData(client, creatorAddress) @@ -255,8 +254,8 @@ async function processSubscriptionEvent( if (!oldCount) return oldCount return { ...oldCount, - ids: [...oldCount.ids, updatedPostId], approved: oldCount.approved + 1, + unapproved: oldCount.unapproved - 1, } } ) diff --git a/src/services/datahub/posts/subscription.tsx b/src/services/datahub/posts/subscription.tsx index cd1660eef..704678659 100644 --- a/src/services/datahub/posts/subscription.tsx +++ b/src/services/datahub/posts/subscription.tsx @@ -239,11 +239,12 @@ async function processMessage( queryClient, { address: myAddress, chatId: rootPostId ?? '' } ) - if (count.unapproved === 1 || count.unapproved === 3) { + const sentMeme = count.approved + count.unapproved + if (sentMeme === 1 || sentMeme === 3) { useMessageData.getState().setOpenMessageModal('on-review') } else { const remaining = Math.max( - MIN_MEME_FOR_REVIEW - (count.unapproved ?? 0), + MIN_MEME_FOR_REVIEW - (sentMeme ?? 0), 0 ) const title = 'Under review' @@ -254,11 +255,7 @@ async function processMessage( } points have been used. We received your meme! We need at least ${remaining} more meme${ remaining > 1 ? 's' : '' } from you to mark you as a verified creator.` - : `${ - tokenomics.socialActionPrice.createCommentPoints - } points have been used. We received ${ - count ?? 0 - } memes from you! Now we need a bit of time to finish review you as a verified creator.` + : `${tokenomics.socialActionPrice.createCommentPoints} points have been used. We received ${sentMeme} memes from you! Now we need a bit of time to finish review you as a verified creator.` toast.custom((t) => (