mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-21 17:05:22 +03:00
fix: refresh status after edit (#2032)
This commit is contained in:
parent
c7b77216c1
commit
ccf115ca4c
3 changed files with 13 additions and 3 deletions
|
@ -7,6 +7,10 @@ const props = defineProps<{
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: 'afterEdit'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
const { details, command } = $(props)
|
const { details, command } = $(props)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -101,10 +105,11 @@ function reply() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function editStatus() {
|
async function editStatus() {
|
||||||
openPublishDialog(`edit-${status.id}`, {
|
await openPublishDialog(`edit-${status.id}`, {
|
||||||
...await getDraftFromStatus(status),
|
...await getDraftFromStatus(status),
|
||||||
editingStatus: status,
|
editingStatus: status,
|
||||||
}, true)
|
}, true)
|
||||||
|
emit('afterEdit')
|
||||||
}
|
}
|
||||||
|
|
||||||
function showFavoritedAndBoostedBy() {
|
function showFavoritedAndBoostedBy() {
|
||||||
|
|
|
@ -10,6 +10,10 @@ const props = withDefaults(defineProps<{
|
||||||
actions: true,
|
actions: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
(event: 'refetchStatus'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
const status = $computed(() => {
|
const status = $computed(() => {
|
||||||
if (props.status.reblog && props.status.reblog)
|
if (props.status.reblog && props.status.reblog)
|
||||||
return props.status.reblog
|
return props.status.reblog
|
||||||
|
@ -27,7 +31,7 @@ useHydratedHead({
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :id="`status-${status.id}`" flex flex-col gap-2 pt2 pb1 ps-3 pe-4 relative :lang="status.language ?? undefined" aria-roledescription="status-details">
|
<div :id="`status-${status.id}`" flex flex-col gap-2 pt2 pb1 ps-3 pe-4 relative :lang="status.language ?? undefined" aria-roledescription="status-details">
|
||||||
<StatusActionsMore :status="status" absolute inset-ie-2 top-2 />
|
<StatusActionsMore :status="status" absolute inset-ie-2 top-2 @after-edit="$emit('refetchStatus')" />
|
||||||
<NuxtLink :to="getAccountRoute(status.account)" rounded-full hover:bg-active transition-100 pe5 me-a>
|
<NuxtLink :to="getAccountRoute(status.account)" rounded-full hover:bg-active transition-100 pe5 me-a>
|
||||||
<AccountHoverWrapper :account="status.account">
|
<AccountHoverWrapper :account="status.account">
|
||||||
<AccountInfo :account="status.account" />
|
<AccountInfo :account="status.account" />
|
||||||
|
|
|
@ -16,7 +16,7 @@ const main = ref<ComponentPublicInstance | null>(null)
|
||||||
|
|
||||||
const { data: status, pending, refresh: refreshStatus } = useAsyncData(
|
const { data: status, pending, refresh: refreshStatus } = useAsyncData(
|
||||||
`status:${id}`,
|
`status:${id}`,
|
||||||
() => fetchStatus(id),
|
() => fetchStatus(id, true),
|
||||||
{ watch: [isHydrated], immediate: isHydrated.value, default: () => shallowRef() },
|
{ watch: [isHydrated], immediate: isHydrated.value, default: () => shallowRef() },
|
||||||
)
|
)
|
||||||
const { client } = $(useMasto())
|
const { client } = $(useMasto())
|
||||||
|
@ -83,6 +83,7 @@ onReactivated(() => {
|
||||||
:newer="context?.ancestors.at(-1)"
|
:newer="context?.ancestors.at(-1)"
|
||||||
command
|
command
|
||||||
style="scroll-margin-top: 60px"
|
style="scroll-margin-top: 60px"
|
||||||
|
@refetch-status="refreshStatus()"
|
||||||
/>
|
/>
|
||||||
<PublishWidget
|
<PublishWidget
|
||||||
v-if="currentUser"
|
v-if="currentUser"
|
||||||
|
|
Loading…
Reference in a new issue