feat(settings): respect settings from server (#1013)

This commit is contained in:
三咲智子 Kevin Deng 2023-01-13 01:52:52 +08:00 committed by GitHub
parent 32aa47e701
commit 9a41b9b7d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 230 additions and 167 deletions

View file

@ -11,6 +11,8 @@ const focusEditor = inject<typeof noop>('focus-editor', noop)
const { details, command } = $(props)
const userSettings = useUserSettings()
const {
status,
isLoading,
@ -53,7 +55,7 @@ const reply = () => {
<div flex-1>
<StatusActionButton
:content="$t('action.boost')"
:text="!getWellnessSetting('hideBoostCount') && status.reblogsCount ? status.reblogsCount : ''"
:text="!getWellnessSetting(userSettings, 'hideBoostCount') && status.reblogsCount ? status.reblogsCount : ''"
color="text-green" hover="text-green" group-hover="bg-green/10"
icon="i-ri:repeat-line"
active-icon="i-ri:repeat-fill"
@ -62,7 +64,7 @@ const reply = () => {
:command="command"
@click="toggleReblog()"
>
<template v-if="status.reblogsCount && !getWellnessSetting('hideBoostCount')" #text>
<template v-if="status.reblogsCount && !getWellnessSetting(userSettings, 'hideBoostCount')" #text>
<CommonLocalizedNumber
keypath="action.boost_count"
:count="status.reblogsCount"
@ -74,7 +76,7 @@ const reply = () => {
<div flex-1>
<StatusActionButton
:content="$t('action.favourite')"
:text="!getWellnessSetting('hideFavoriteCount') && status.favouritesCount ? status.favouritesCount : ''"
:text="!getWellnessSetting(userSettings, 'hideFavoriteCount') && status.favouritesCount ? status.favouritesCount : ''"
color="text-rose" hover="text-rose" group-hover="bg-rose/10"
icon="i-ri:heart-3-line"
active-icon="i-ri:heart-3-fill"
@ -83,7 +85,7 @@ const reply = () => {
:command="command"
@click="toggleFavourite()"
>
<template v-if="status.favouritesCount && !getWellnessSetting('hideFavoriteCount')" #text>
<template v-if="status.favouritesCount && !getWellnessSetting(userSettings, 'hideFavoriteCount')" #text>
<CommonLocalizedNumber
keypath="action.favourite_count"
:count="status.favouritesCount"

View file

@ -23,6 +23,7 @@ const clipboard = useClipboard()
const router = useRouter()
const route = useRoute()
const { t } = useI18n()
const userSettings = useUserSettings()
const isAuthor = $computed(() => status.account.id === currentUser.value?.account.id)

View file

@ -22,6 +22,7 @@ const props = withDefaults(
}>(),
{ actions: true },
)
const userSettings = useUserSettings()
const status = $computed(() => {
if (props.status.reblog && !props.status.content)