forked from Mirrors/elk
refactor: rename
This commit is contained in:
parent
8af8abfc9f
commit
66295199b4
10 changed files with 15 additions and 15 deletions
2
app.vue
2
app.vue
|
@ -3,7 +3,7 @@ setupPageHeader()
|
|||
provideGlobalCommands()
|
||||
|
||||
// We want to trigger rerendering the page when account changes
|
||||
const key = computed(() => currentUser.value ? getUniqueUserId(currentUser.value) : '')
|
||||
const key = computed(() => getUniqueUserId(currentUser.value))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -7,7 +7,7 @@ const { account, command, ...props } = defineProps<{
|
|||
command?: boolean
|
||||
}>()
|
||||
|
||||
const isSelf = $computed(() => checkUser(currentUser.value) && currentUser.value.account.id === account.id)
|
||||
const isSelf = $computed(() => checkAuth(currentUser.value) && currentUser.value.account.id === account.id)
|
||||
const enable = $computed(() => !isSelf && !isGuest.value)
|
||||
const relationship = $computed(() => props.relationship || useRelationship(account).value)
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ watchEffect(() => {
|
|||
iconFields.value = icons
|
||||
})
|
||||
|
||||
const isSelf = $computed(() => checkUser(currentUser.value) && currentUser.value.account.id === account.id)
|
||||
const isSelf = $computed(() => checkAuth(currentUser.value) && currentUser.value.account.id === account.id)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -7,7 +7,7 @@ const { account } = defineProps<{
|
|||
}>()
|
||||
let relationship = $(useRelationship(account))
|
||||
|
||||
const isSelf = $computed(() => checkUser(currentUser.value) && currentUser.value.account.id === account.id)
|
||||
const isSelf = $computed(() => checkAuth(currentUser.value) && currentUser.value.account.id === account.id)
|
||||
|
||||
const masto = useMasto()
|
||||
const toggleMute = async () => {
|
||||
|
|
|
@ -23,7 +23,7 @@ const clipboard = useClipboard()
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const isAuthor = $computed(() => checkUser(currentUser.value) && status.account.id === currentUser.value.account.id)
|
||||
const isAuthor = $computed(() => checkAuth(currentUser.value) && status.account.id === currentUser.value.account.id)
|
||||
|
||||
const {
|
||||
toggle: _toggleTranslation,
|
||||
|
|
|
@ -24,7 +24,7 @@ const account = isSelf ? computed(() => status.account) : useAccountById(status.
|
|||
<template v-if="!collapsed">
|
||||
<AccountAvatar
|
||||
v-if="isSelf || simplified
|
||||
|| (checkUser(currentUser) && status.inReplyToAccountId === currentUser?.account.id)"
|
||||
|| (checkAuth(currentUser) && status.inReplyToAccountId === currentUser?.account.id)"
|
||||
:account="account" :link="false" w-5 h-5 mx-0.5
|
||||
/>
|
||||
<AccountInlineInfo v-else :account="account" :link="false" mx-0.5 />
|
||||
|
|
|
@ -97,7 +97,7 @@ async function subscribe(
|
|||
|
||||
async function unsubscribeFromBackend(fromSWPushManager: boolean, removePushNotification = true) {
|
||||
const cu = currentUser.value
|
||||
if (checkUser(cu)) {
|
||||
if (checkAuth(cu)) {
|
||||
await removePushNotifications(cu)
|
||||
removePushNotification && await removePushNotificationData(cu, fromSWPushManager)
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ async function unsubscribeFromBackend(fromSWPushManager: boolean, removePushNoti
|
|||
|
||||
async function removePushNotificationDataOnError(e: Error) {
|
||||
const cu = currentUser.value
|
||||
if (checkUser(cu))
|
||||
if (checkAuth(cu))
|
||||
await removePushNotificationData(cu, true)
|
||||
|
||||
throw e
|
||||
|
|
|
@ -109,7 +109,7 @@ export const usePushManager = () => {
|
|||
}
|
||||
|
||||
const unsubscribe = async () => {
|
||||
if (!isSupported || !isSubscribed || !checkUser(currentUser.value))
|
||||
if (!isSupported || !isSubscribed || !checkAuth(currentUser.value))
|
||||
return false
|
||||
|
||||
await removePushNotifications(currentUser.value)
|
||||
|
@ -117,7 +117,7 @@ export const usePushManager = () => {
|
|||
}
|
||||
|
||||
const saveSettings = async (policy?: SubscriptionPolicy) => {
|
||||
if (!checkUser(currentUser.value))
|
||||
if (!checkAuth(currentUser.value))
|
||||
return
|
||||
|
||||
if (policy)
|
||||
|
@ -136,7 +136,7 @@ export const usePushManager = () => {
|
|||
}
|
||||
|
||||
const undoChanges = () => {
|
||||
if (!checkUser(currentUser.value))
|
||||
if (!checkAuth(currentUser.value))
|
||||
return
|
||||
|
||||
const current = pushNotificationData.value
|
||||
|
|
|
@ -70,8 +70,8 @@ export const currentServer = computed<string>(() => currentUser.value.server)
|
|||
export const currentInstance = computed<null | Instance>(() => {
|
||||
return instances.value[currentServer.value] ?? null
|
||||
})
|
||||
export const checkUser = (val: UserLogin | undefined): val is UserLogin<true> => !!(val && !val.guest)
|
||||
export const isGuest = computed(() => !checkUser(currentUser.value))
|
||||
export const checkAuth = (val: UserLogin | undefined): val is UserLogin<true> => !!(val && !val.guest)
|
||||
export const isGuest = computed(() => !checkAuth(currentUser.value))
|
||||
export const getUniqueUserId = (user: UserLogin) =>
|
||||
user.guest ? `${GUEST_ID}@${user.server}` : user.account.id
|
||||
export const isSameUser = (a: UserLogin | undefined, b: UserLogin | undefined) =>
|
||||
|
@ -264,7 +264,7 @@ export async function signout() {
|
|||
if (!users.value.some((u, i) => u.server === currentUser.value.server && i !== index))
|
||||
delete instances.value[currentUser.value.server]
|
||||
|
||||
if (checkUser(currentUser.value)) {
|
||||
if (checkAuth(currentUser.value)) {
|
||||
await removePushNotifications(currentUser.value)
|
||||
await removePushNotificationData(currentUser.value)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ const wideLayout = computed(() => route.meta.wideLayout ?? false)
|
|||
<UserPicker v-if="showUserPicker" />
|
||||
<div v-else flex="~" items-center justify-between>
|
||||
<NuxtLink
|
||||
v-if="checkUser(currentUser)"
|
||||
v-if="checkAuth(currentUser)"
|
||||
hidden xl:block
|
||||
rounded-full text-start w-full
|
||||
hover:bg-active cursor-pointer transition-100
|
||||
|
|
Loading…
Reference in a new issue