From bab704992ff71b823dee50e5c0de414b8c0eb910 Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Tue, 26 Mar 2024 16:59:42 +0800 Subject: [PATCH] feat: add post history page --- locales/en-US.yml | 1 + locales/zh-CN.yml | 1 + .../src/server/api/endpoints/notes/history.ts | 3 + .../src/components/MkDateSeparatedList.vue | 2 +- packages/client/src/components/MkNote.vue | 8 +- packages/client/src/filters/note.ts | 9 +- packages/client/src/pages/note-history.vue | 123 ++++++++++++++++++ packages/client/src/router.ts | 5 + packages/client/src/scripts/get-note-menu.ts | 17 +++ packages/firefish-js/src/api.types.ts | 9 ++ packages/firefish-js/src/entities.ts | 13 +- 11 files changed, 186 insertions(+), 5 deletions(-) create mode 100644 packages/client/src/pages/note-history.vue diff --git a/locales/en-US.yml b/locales/en-US.yml index 88b44d2787..9a85183fe3 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2232,3 +2232,4 @@ messagingUnencryptedInfo: "Chats on Firefish are not end-to-end encrypted. Don't any sensitive infomation over Firefish." autocorrectNoteLanguage: "Show a warning if the post language does not match the auto-detected result" incorrectLanguageWarning: "It looks like your post is in {detected}, but you selected {current}.\nWould you like to set the language to {detected} instead?" +noteEditHistory: "Post edit history" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index f67bf4a600..85b73d7b45 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -2060,3 +2060,4 @@ noAltTextWarning: 有些附件没有描述。您是否忘记写描述了? showNoAltTextWarning: 当您尝试发布没有描述的帖子附件时显示警告 autocorrectNoteLanguage: 当帖子语言不符合自动检测的结果的时候显示警告 incorrectLanguageWarning: "看上去您帖子使用的语言是{detected},但您选择的语言是{current}。\n要改为以{detected}发帖吗?" +noteEditHistory: "帖子编辑历史" diff --git a/packages/backend/src/server/api/endpoints/notes/history.ts b/packages/backend/src/server/api/endpoints/notes/history.ts index e0c7be3df5..fb49b4a5b9 100644 --- a/packages/backend/src/server/api/endpoints/notes/history.ts +++ b/packages/backend/src/server/api/endpoints/notes/history.ts @@ -58,6 +58,9 @@ export default define(meta, paramDef, async (ps, user) => { }, take: ps.limit, skip: ps.offset, + order: { + id: "DESC" + }, }); return await NoteEdits.packMany(history); diff --git a/packages/client/src/components/MkDateSeparatedList.vue b/packages/client/src/components/MkDateSeparatedList.vue index e40d64dd7d..c6b75a20fc 100644 --- a/packages/client/src/components/MkDateSeparatedList.vue +++ b/packages/client/src/components/MkDateSeparatedList.vue @@ -10,7 +10,7 @@ export default defineComponent({ props: { items: { type: Array as PropType< - { id: string; createdAt: string; _shouldInsertAd_: boolean }[] + { id: string; createdAt: string; _shouldInsertAd_?: boolean }[] >, required: true, }, diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index e13050206b..723fabbeee 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -154,7 +154,12 @@ {{ appearNote.channel.name }} -