From e4f200b6a67ef596415df62ba5d6d1a8e992e289 Mon Sep 17 00:00:00 2001 From: Andrey Mikhadyuk Date: Thu, 30 Nov 2023 11:59:32 +0400 Subject: [PATCH] filter out non-discussion/proposal items in inbox fetches --- src/shared/hooks/useCases/useInboxItems.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shared/hooks/useCases/useInboxItems.ts b/src/shared/hooks/useCases/useInboxItems.ts index 5966ae3f4d..e52ed2c95a 100644 --- a/src/shared/hooks/useCases/useInboxItems.ts +++ b/src/shared/hooks/useCases/useInboxItems.ts @@ -13,6 +13,7 @@ import { useIsMounted } from "@/shared/hooks"; import { FeedLayoutItemWithFollowData } from "@/shared/interfaces"; import { ChatChannel, + CommonFeedType, FeedItemFollow, FeedItemFollowWithMetadata, } from "@/shared/models"; @@ -189,13 +190,16 @@ export const useInboxItems = ( return; } + const filteredData = data.filter(({ item }) => + [CommonFeedType.Discussion, CommonFeedType.Proposal].includes(item.type), + ); const finalData = feedItemIdsForNotListening && feedItemIdsForNotListening.length > 0 - ? data.filter( + ? filteredData.filter( (item) => !feedItemIdsForNotListening.includes(item.item.feedItemId), ) - : data; + : filteredData; setNewItemsBatches((currentItems) => [...currentItems, finalData]); };