elk/components/conversation/ConversationPaginator.vue

26 lines
906 B
Vue
Raw Normal View History

2022-11-18 09:37:22 +00:00
<script setup lang="ts">
2024-01-09 08:56:15 +00:00
import type { mastodon } from 'masto'
2022-11-18 09:37:22 +00:00
const { paginator } = defineProps<{
2024-01-09 08:56:15 +00:00
paginator: mastodon.Paginator<mastodon.v1.Conversation[], mastodon.DefaultPaginationParams>
2022-11-18 09:37:22 +00:00
}>()
function preprocess(items: mastodon.v1.Conversation[]): mastodon.v1.Conversation[] {
2023-02-05 15:05:42 +00:00
const isAuthored = (conversation: mastodon.v1.Conversation) => conversation.lastStatus ? conversation.lastStatus.account.id === currentUser.value?.account.id : false
return items.filter(item => isAuthored(item) || !item.lastStatus?.filtered?.find(
filter => filter.filter.filterAction === 'hide' && filter.filter.context.includes('thread'),
))
}
2022-11-18 09:37:22 +00:00
</script>
<template>
<CommonPaginator :paginator="paginator" :preprocess="preprocess">
2022-11-18 09:37:22 +00:00
<template #default="{ item }">
<ConversationCard
:conversation="item"
2022-11-23 02:16:31 +00:00
border="b base" py-1
2022-11-18 09:37:22 +00:00
/>
</template>
</CommonPaginator>
</template>