diff --git a/components/status/StatusCard.vue b/components/status/StatusCard.vue index 7967dfc9..a988bc6f 100644 --- a/components/status/StatusCard.vue +++ b/components/status/StatusCard.vue @@ -3,6 +3,7 @@ import type { mastodon } from 'masto' const { actions = true, older, newer, hasOlder, hasNewer, main, ...props } = defineProps<{ status: mastodon.v1.Status + followedTag?: string | null actions?: boolean context?: mastodon.v2.FilterContext hover?: boolean @@ -61,10 +62,6 @@ const collapseRebloggedBy = computed(() => rebloggedBy.value?.id === status.valu const isDM = computed(() => status.value.visibility === 'direct') const isPinned = computed(() => status.value.pinned) -// limit 0 should get all w/o pagination, but might need checking -const followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 0 })).map(tag => tag.name) -const statusTagsFollowed = computed(() => status.value.tags.filter(tag => followedTags.includes(tag.name)).map(tag => tag.name)) - const showUpperBorder = computed(() => newer && !directReply.value) const showReplyTo = computed(() => !replyToMain.value && !directReply.value) @@ -80,14 +77,14 @@ const forceShow = ref(false)
- {{ statusTagsFollowed[0] }} + {{ followedTag }}
diff --git a/components/timeline/TimelineHome.vue b/components/timeline/TimelineHome.vue index a3a4cf46..6ea6d2f3 100644 --- a/components/timeline/TimelineHome.vue +++ b/components/timeline/TimelineHome.vue @@ -10,12 +10,14 @@ const stream = useStreaming(client => client.user.subscribe()) function reorderAndFilter(items: mastodon.v1.Status[]) { return reorderedTimeline(items, 'home') } + +const followedTags = (await useMasto().client.value.v1.followedTags.list({ limit: 0 })) diff --git a/components/timeline/TimelinePaginator.vue b/components/timeline/TimelinePaginator.vue index 5c1d7b97..ab806e11 100644 --- a/components/timeline/TimelinePaginator.vue +++ b/components/timeline/TimelinePaginator.vue @@ -4,11 +4,12 @@ import type { mastodon } from 'masto' import { DynamicScrollerItem } from 'vue-virtual-scroller' import 'vue-virtual-scroller/dist/vue-virtual-scroller.css' -const { account, buffer = 10, endMessage = true } = defineProps<{ +const { account, buffer = 10, endMessage = true, followedTags = [] } = defineProps<{ paginator: mastodon.Paginator stream?: mastodon.streaming.Subscription context?: mastodon.v2.FilterContext account?: mastodon.v1.Account + followedTags?: mastodon.v1.Tag[] preprocess?: (items: mastodon.v1.Status[]) => mastodon.v1.Status[] buffer?: number endMessage?: boolean | string @@ -20,6 +21,12 @@ const virtualScroller = usePreferences('experimentalVirtualScroller') const showOriginSite = computed(() => account && account.id !== currentUser.value?.account.id && getServerName(account) !== currentServer.value, ) + +function getFollowedTag(status: mastodon.v1.Status): string | null { + const followedTagNames = followedTags.map(tag => tag.name) + const followedStatusTags = status.tags.filter(tag => followedTagNames.includes(tag.name)) + return followedStatusTags.length ? followedStatusTags[0]?.name : null +}