2022-11-26 14:05:44 +09:00
|
|
|
<script setup lang="ts">
|
2023-01-08 15:21:09 +09:00
|
|
|
import type { mastodon } from 'masto'
|
2022-12-28 03:00:42 +09:00
|
|
|
import { formatTimeAgo } from '@vueuse/core'
|
2022-11-26 14:05:44 +09:00
|
|
|
|
|
|
|
const { status } = defineProps<{
|
2023-01-08 15:21:09 +09:00
|
|
|
status: mastodon.v1.Status
|
2022-11-26 14:05:44 +09:00
|
|
|
}>()
|
|
|
|
|
2023-01-15 17:38:02 +09:00
|
|
|
const paginator = useMastoClient().v1.statuses.listHistory(status.id)
|
2022-11-26 14:05:44 +09:00
|
|
|
|
2023-01-08 15:21:09 +09:00
|
|
|
const showHistory = (edit: mastodon.v1.StatusEdit) => {
|
2022-11-26 14:05:44 +09:00
|
|
|
openEditHistoryDialog(edit)
|
|
|
|
}
|
2022-12-02 11:18:36 +09:00
|
|
|
const timeAgoOptions = useTimeAgoOptions()
|
2023-01-08 17:51:45 +09:00
|
|
|
|
2023-01-09 01:04:26 +09:00
|
|
|
// TODO: rework, this is only reversing the first page of edits
|
2023-01-08 17:51:45 +09:00
|
|
|
const reverseHistory = (items: mastodon.v1.StatusEdit[]) =>
|
|
|
|
[...items].reverse()
|
2022-11-26 14:05:44 +09:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-01-09 01:04:26 +09:00
|
|
|
<CommonPaginator :paginator="paginator" key-prop="createdAt" :preprocess="reverseHistory" :buffer="0">
|
2023-01-08 17:51:45 +09:00
|
|
|
<template #default="{ items, item, index }">
|
|
|
|
<CommonDropdownItem
|
|
|
|
px="0.5"
|
|
|
|
@click="showHistory(item)"
|
|
|
|
>
|
|
|
|
{{ getDisplayName(item.account) }}
|
2022-12-28 03:00:42 +09:00
|
|
|
|
2023-01-08 17:51:45 +09:00
|
|
|
<template v-if="index === items.length - 1">
|
|
|
|
<i18n-t keypath="status_history.created">
|
|
|
|
{{ formatTimeAgo(new Date(item.createdAt), timeAgoOptions) }}
|
|
|
|
</i18n-t>
|
|
|
|
</template>
|
|
|
|
<i18n-t v-else keypath="status_history.edited">
|
|
|
|
{{ formatTimeAgo(new Date(item.createdAt), timeAgoOptions) }}
|
2022-12-28 03:00:42 +09:00
|
|
|
</i18n-t>
|
2023-01-08 17:51:45 +09:00
|
|
|
</CommonDropdownItem>
|
|
|
|
</template>
|
|
|
|
<template #loading>
|
|
|
|
<StatusEditHistorySkeleton />
|
|
|
|
<StatusEditHistorySkeleton op50 />
|
|
|
|
<StatusEditHistorySkeleton op25 />
|
|
|
|
</template>
|
|
|
|
<template #done>
|
|
|
|
<span />
|
|
|
|
</template>
|
|
|
|
</CommonPaginator>
|
2022-11-26 14:05:44 +09:00
|
|
|
</template>
|