🐛 Fix bugs causing by upgraded to v2

This commit is contained in:
LittleSheep 2024-12-08 15:36:03 +08:00
parent 6693acb24a
commit b9d89149b0
4 changed files with 13 additions and 24 deletions

View File

@ -2,15 +2,15 @@
<v-card :to="url" class="mx-[2.5ch] mb-3"> <v-card :to="url" class="mx-[2.5ch] mb-3">
<v-card-text> <v-card-text>
<div class="mb-3 flex flex-row gap-4"> <div class="mb-3 flex flex-row gap-4">
<nuxt-link :to="`/users/${post.author?.name}`"> <nuxt-link :to="`/users/${post.publisher?.name}`">
<v-avatar :image="post.author?.avatar" /> <v-avatar :image="post.publisher?.avatar" />
</nuxt-link> </nuxt-link>
<div class="flex flex-col"> <div class="flex flex-col">
<span>{{ post.author?.nick }} <span class="text-xs">@{{ post.author?.name }}</span></span> <span>{{ post.publisher?.nick }} <span class="text-xs">@{{ post.publisher?.name }}</span></span>
<span v-if="post.body?.title" class="text-md">{{ post.body?.title }}</span> <span v-if="post.body?.title" class="text-md">{{ post.body?.title }}</span>
<span v-if="post.body?.description" class="text-sm">{{ post.body?.description }}</span> <span v-if="post.body?.description" class="text-sm">{{ post.body?.description }}</span>
<span v-if="!post.body?.title && !post.body?.description" class="text-sm"> <span v-if="!post.body?.title && !post.body?.description" class="text-sm">
{{ post.author?.description }} {{ post.publisher?.description }}
</span> </span>
<div v-if="post.type != 'story'" class="mt-1"> <div v-if="post.type != 'story'" class="mt-1">

View File

@ -19,8 +19,8 @@ async function loadPost({ done }: any) {
offset: posts.value.length.toString(), offset: posts.value.length.toString(),
}) })
if (props.author) { if (props.publisher) {
searchQueries.set("author", props.author) searchQueries.set("author", props.publisher)
} }
if (props.realm) { if (props.realm) {
searchQueries.set("realm", props.realm) searchQueries.set("realm", props.realm)

View File

@ -10,16 +10,6 @@
</div> </div>
</v-col> </v-col>
<v-col cols="12" md="4" class="px-5 pt-3"> <v-col cols="12" md="4" class="px-5 pt-3">
<div class="mt-3 mb-4.5 mx-[2.5ch] flex flex-row gap-4 items-center">
<nuxt-link :to="`/users/${attachment.account?.name}`">
<v-avatar :image="attachment.account?.avatar" />
</nuxt-link>
<div class="flex flex-col">
<span class="text-xs">Uploaded by</span>
<span>{{ attachment.account?.nick }} <span class="text-xs">@{{ attachment.account?.name }}</span></span>
</div>
</div>
<v-card class="mb-5"> <v-card class="mb-5">
<v-card-text class="flex flex-col gap-4"> <v-card-text class="flex flex-col gap-4">
<div class="flex flex-col" v-if="attachment?.alt"> <div class="flex flex-col" v-if="attachment?.alt">
@ -84,7 +74,7 @@ if (!attachment.value) {
}) })
} }
const title = computed(() => `Attachment from ${attachment.value.account.nick}`) const title = computed(() => `Attachment ${attachment.value?.id}`)
watch(attachment, (value) => { watch(attachment, (value) => {
if (value.mimetype.split("/")[0] == "image") { if (value.mimetype.split("/")[0] == "image") {
@ -106,7 +96,6 @@ useHead({
}) })
useSeoMeta({ useSeoMeta({
author: attachment.value?.account.nick,
title: title, title: title,
description: attachment.value?.alt, description: attachment.value?.alt,
ogTitle: title, ogTitle: title,

View File

@ -1,14 +1,14 @@
<template> <template>
<v-container class="content-container mx-auto"> <v-container class="content-container mx-auto">
<div class="my-3 flex flex-row gap-4"> <div class="my-3 flex flex-row gap-4">
<nuxt-link :to="`/users/${post.author?.name}`"> <nuxt-link :to="`/users/${post.publisher?.name}`">
<v-avatar :image="post.author?.avatar" /> <v-avatar :image="post.publisher?.avatar" />
</nuxt-link> </nuxt-link>
<div class="flex flex-col"> <div class="flex flex-col">
<span>{{ post.author?.nick }} <span class="text-xs">@{{ post.author?.name }}</span></span> <span>{{ post.publisher?.nick }} <span class="text-xs">@{{ post.publisher?.name }}</span></span>
<span v-if="post.body?.title" class="text-md">{{ post.body?.title }}</span> <span v-if="post.body?.title" class="text-md">{{ post.body?.title }}</span>
<span v-if="post.body?.description" class="text-sm">{{ post.body?.description }}</span> <span v-if="post.body?.description" class="text-sm">{{ post.body?.description }}</span>
<span v-if="!post.body?.title && !post.body?.description" class="text-sm">{{ post.author?.description }}</span> <span v-if="!post.body?.title && !post.body?.description" class="text-sm">{{ post.publisher?.description }}</span>
</div> </div>
</div> </div>
@ -108,7 +108,7 @@ if (!post.value) {
navigateTo(`/posts/${post.value.area_alias}/${post.value.alias}`) navigateTo(`/posts/${post.value.area_alias}/${post.value.alias}`)
} }
const title = computed(() => post.value.body?.title ? `${post.value.body?.title} by @${post.value.author.name}` : `Post by @${post.value.author.name}`) const title = computed(() => post.value.body?.title ? `${post.value.body?.title} by @${post.value.publisher.name}` : `Post by @${post.value.publisher.name}`)
const description = computed(() => post.value.body?.description ?? post.value.body?.content.substring(0, 280).trim()) const description = computed(() => post.value.body?.description ?? post.value.body?.content.substring(0, 280).trim())
watch(attachments, (value) => { watch(attachments, (value) => {
@ -134,7 +134,7 @@ useHead({
}) })
useSeoMeta({ useSeoMeta({
author: post.value.author.nick, author: post.value.publisher.nick,
title: title, title: title,
articlePublishedTime: post.value.publishedAt, articlePublishedTime: post.value.publishedAt,
description: description, description: description,