Skip to content

Commit

Permalink
filter out non-discussion/proposal items in inbox fetches
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymikhadyuk committed Nov 30, 2023
1 parent 561d89e commit e4f200b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/shared/hooks/useCases/useInboxItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useIsMounted } from "@/shared/hooks";
import { FeedLayoutItemWithFollowData } from "@/shared/interfaces";
import {
ChatChannel,
CommonFeedType,
FeedItemFollow,
FeedItemFollowWithMetadata,
} from "@/shared/models";
Expand Down Expand Up @@ -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]);
};

Expand Down

0 comments on commit e4f200b

Please sign in to comment.