2022-11-26 05:05:44 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { Status, StatusEdit } from 'masto'
|
|
|
|
|
|
|
|
const { status } = defineProps<{
|
|
|
|
status: Status
|
|
|
|
}>()
|
|
|
|
|
2022-11-26 15:42:58 +00:00
|
|
|
const { data: statusEdits } = useAsyncData(`status:history:${status.id}`, () => useMasto().statuses.fetchHistory(status.id).then(res => res.reverse()))
|
2022-11-26 05:05:44 +00:00
|
|
|
|
|
|
|
const showHistory = (edit: StatusEdit) => {
|
|
|
|
openEditHistoryDialog(edit)
|
|
|
|
}
|
2022-12-02 02:18:36 +00:00
|
|
|
const timeAgoOptions = useTimeAgoOptions()
|
2022-11-26 05:05:44 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template v-if="statusEdits">
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-for="(edit, idx) in statusEdits"
|
|
|
|
:key="idx"
|
|
|
|
px="0.5"
|
|
|
|
@click="showHistory(edit)"
|
|
|
|
>
|
|
|
|
{{ getDisplayName(edit.account) }}
|
2022-12-01 13:59:28 +00:00
|
|
|
<i18n-t :keypath="`status_history.${idx === statusEdits.length - 1 ? 'created' : 'edited'}`">
|
2022-12-02 02:18:36 +00:00
|
|
|
{{ useTimeAgo(edit.createdAt, timeAgoOptions).value }}
|
2022-12-01 13:59:28 +00:00
|
|
|
</i18n-t>
|
2022-11-26 05:05:44 +00:00
|
|
|
</CommonDropdownItem>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<div i-ri:loader-2-fill animate-spin text-2xl ma />
|
|
|
|
</template>
|
|
|
|
</template>
|