From 81b9fdf397d5f63ae5249d6ba27dee924051be53 Mon Sep 17 00:00:00 2001 From: naskya Date: Mon, 1 Apr 2024 13:58:54 +0900 Subject: [PATCH] refactor (client): stop importing things directly from firefish-js/src --- packages/client/src/pages/note-history.vue | 40 ++++++++++++---------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/packages/client/src/pages/note-history.vue b/packages/client/src/pages/note-history.vue index 44a9d9716e..aaf8519728 100644 --- a/packages/client/src/pages/note-history.vue +++ b/packages/client/src/pages/note-history.vue @@ -8,12 +8,12 @@
>(); @@ -66,7 +66,7 @@ definePageMetadata( })), ); -const note = ref({} as Note); +const note = ref({} as entities.Note); const loaded = ref(false); onMounted(() => { @@ -84,8 +84,8 @@ onMounted(() => { }); }); -function convertNoteEditsToNotes(noteEdits: NoteEdit[]) { - const now: NoteEdit = { +function convertNoteEditsToNotes(noteEdits: entities.NoteEdit[]) { + const now: entities.NoteEdit = { id: "EditionNow", noteId: note.value.id, updatedAt: note.value.createdAt, @@ -96,20 +96,22 @@ function convertNoteEditsToNotes(noteEdits: NoteEdit[]) { emojis: note.value.emojis, }; - return [now].concat(noteEdits).map((noteEdit: NoteEdit, index, arr): Note => { - return Object.assign({}, note.value, { - historyId: noteEdit.id, - // Conversion from updatedAt to createdAt - // The createdAt of a edition's content is actually the updatedAt of the previous one. - createdAt: arr[(index + 1) % arr.length].updatedAt, - text: noteEdit.text, - cw: noteEdit.cw, - _shouldInsertAd_: false, - files: noteEdit.files, - fileIds: noteEdit.fileIds, - emojis: note.value.emojis.concat(noteEdit.emojis), + return [now] + .concat(noteEdits) + .map((noteEdit: entities.NoteEdit, index, arr): entities.Note => { + return Object.assign({}, note.value, { + historyId: noteEdit.id, + // Conversion from updatedAt to createdAt + // The createdAt of a edition's content is actually the updatedAt of the previous one. + createdAt: arr[(index + 1) % arr.length].updatedAt, + text: noteEdit.text, + cw: noteEdit.cw, + _shouldInsertAd_: false, + files: noteEdit.files, + fileIds: noteEdit.fileIds, + emojis: note.value.emojis.concat(noteEdit.emojis), + }); }); - }); }