From 267624c7a3631538d182a6be6a4762a1a4926fc5 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Mon, 2 Oct 2023 17:55:32 +0200 Subject: [PATCH] [mastodon-client] Also return edit history if post is unedited --- packages/backend/src/server/api/mastodon/helpers/note.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/helpers/note.ts b/packages/backend/src/server/api/mastodon/helpers/note.ts index 034a8a067..c3360f2a9 100644 --- a/packages/backend/src/server/api/mastodon/helpers/note.ts +++ b/packages/backend/src/server/api/mastodon/helpers/note.ts @@ -154,13 +154,11 @@ export class NoteHelpers { } public static async getNoteEditHistory(note: Note): Promise { - if (!note.updatedAt) return []; const cache = UserHelpers.getFreshAccountCache(); const account = Promise.resolve(note.user ?? await UserHelpers.getUserCached(note.userId, cache)) .then(p => UserConverter.encode(p, cache)); const edits = await NoteEdits.find({where: {noteId: note.id}, order: {id: "ASC"}}); const history: Promise[] = []; - if (edits.length < 1) return []; const curr = { id: note.id, @@ -169,7 +167,7 @@ export class NoteHelpers { text: note.text, cw: note.cw, fileIds: note.fileIds, - updatedAt: note.updatedAt + updatedAt: note.updatedAt ?? note.createdAt } edits.push(curr);