From 28c011ac2ec6e02e3389d62b90938cca4514df10 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sat, 21 Jan 2023 22:53:02 +0100 Subject: [PATCH] feat: filter notifications and conversations --- components/conversation/ConversationPaginator.vue | 15 ++++++++++++++- components/notification/NotificationPaginator.vue | 15 ++++++++++++++- components/status/StatusCard.vue | 5 ----- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/components/conversation/ConversationPaginator.vue b/components/conversation/ConversationPaginator.vue index 40a4c7c7..72ed1840 100644 --- a/components/conversation/ConversationPaginator.vue +++ b/components/conversation/ConversationPaginator.vue @@ -4,10 +4,23 @@ import type { Paginator, mastodon } from 'masto' const { paginator } = defineProps<{ paginator: Paginator }>() + +function preprocess(items: mastodon.v1.Conversation[]) { + const filteredIndices = items.map( + (items, index) => ( + { + status: items.lastStatus, + index, + })) + .filter(item => !!item.status?.filtered?.find(filter => filter.filter.filterAction === 'hide' && filter.filter.context.includes('thread'))) + .map(item => item.index) + + return items.filter((_, index) => !filteredIndices.includes(index)) +}