fix type errors of MkChatPreview
This commit is contained in:
parent
6982843716
commit
0b7ab1b90d
2 changed files with 17 additions and 11 deletions
|
@ -4,14 +4,14 @@
|
||||||
:class="{
|
:class="{
|
||||||
isMe: isMe(message),
|
isMe: isMe(message),
|
||||||
isRead: message.groupId
|
isRead: message.groupId
|
||||||
? message.reads.includes(me?.id)
|
? message.reads.includes(me!.id)
|
||||||
: message.isRead,
|
: message.isRead,
|
||||||
}"
|
}"
|
||||||
:to="
|
:to="
|
||||||
message.groupId
|
message.groupId
|
||||||
? `/my/messaging/group/${message.groupId}`
|
? `/my/messaging/group/${message.groupId}`
|
||||||
: `/my/messaging/${acct.toString(
|
: `/my/messaging/${acct.toString(
|
||||||
isMe(message) ? message.recipient : message.user,
|
isMe(message) ? message.recipient! : message.user,
|
||||||
)}`
|
)}`
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -22,27 +22,27 @@
|
||||||
message.groupId
|
message.groupId
|
||||||
? message.user
|
? message.user
|
||||||
: isMe(message)
|
: isMe(message)
|
||||||
? message.recipient
|
? message.recipient!
|
||||||
: message.user
|
: message.user
|
||||||
"
|
"
|
||||||
:show-indicator="true"
|
:show-indicator="true"
|
||||||
disable-link
|
disable-link
|
||||||
/>
|
/>
|
||||||
<header v-if="message.groupId">
|
<header v-if="message.groupId">
|
||||||
<span class="name">{{ message.group.name }}</span>
|
<span class="name">{{ message.group!.name }}</span>
|
||||||
<MkTime :time="message.createdAt" class="time" />
|
<MkTime :time="message.createdAt" class="time" />
|
||||||
</header>
|
</header>
|
||||||
<header v-else>
|
<header v-else>
|
||||||
<span class="name"
|
<span class="name"
|
||||||
><MkUserName
|
><MkUserName
|
||||||
:user="
|
:user="
|
||||||
isMe(message) ? message.recipient : message.user
|
isMe(message) ? message.recipient! : message.user
|
||||||
"
|
"
|
||||||
/></span>
|
/></span>
|
||||||
<span class="username"
|
<span class="username"
|
||||||
>@{{
|
>@{{
|
||||||
acct.toString(
|
acct.toString(
|
||||||
isMe(message) ? message.recipient : message.user,
|
isMe(message) ? message.recipient! : message.user,
|
||||||
)
|
)
|
||||||
}}</span
|
}}</span
|
||||||
>
|
>
|
||||||
|
@ -65,16 +65,20 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { acct } from "firefish-js";
|
import { acct, type entities } from "firefish-js";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
import { me } from "@/me";
|
import { me } from "@/me";
|
||||||
|
|
||||||
|
if (me == null) {
|
||||||
|
throw "No me";
|
||||||
|
}
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
message: Record<string, any>;
|
message: entities.MessagingMessage;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
function isMe(message): boolean {
|
function isMe(message: entities.MessagingMessage): boolean {
|
||||||
return message.userId === me?.id;
|
return message.userId === me!.id;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,9 @@ export type UserDetailed = UserLite & {
|
||||||
url: string | null;
|
url: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UserGroup = TODO;
|
export type UserGroup = {
|
||||||
|
id: ID;
|
||||||
|
} & Record<string, TODO>;
|
||||||
|
|
||||||
export type UserList = {
|
export type UserList = {
|
||||||
id: ID;
|
id: ID;
|
||||||
|
|
Loading…
Reference in a new issue