feat(account): predict relationship from context

This commit is contained in:
三咲智子 2023-01-10 15:49:49 +08:00
parent b4cda4338f
commit 88731ee18d
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
6 changed files with 20 additions and 10 deletions

View file

@ -1,7 +1,7 @@
import { login as loginMasto } from 'masto'
import type { WsEvents, mastodon } from 'masto'
import type { Ref } from 'vue'
import type { RemovableRef } from '@vueuse/core'
import type { MaybeComputedRef, RemovableRef } from '@vueuse/core'
import type { ElkMasto, UserLogin } from '~/types'
import {
DEFAULT_POST_CHARS_LIMIT,
@ -96,6 +96,8 @@ export const currentUserHandle = computed(() => currentUser.value?.account.id
)
export const useUsers = () => users
export const useSelfAccount = (user: MaybeComputedRef<mastodon.v1.Account | undefined>) =>
computed(() => currentUser.value && resolveUnref(user)?.id === currentUser.value.account.id)
export const characterLimit = computed(() => currentInstance.value?.configuration.statuses.maxCharacters ?? DEFAULT_POST_CHARS_LIMIT)