From 023e2cad731a399e39cf7aa919ca2043e6a31e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sugar=F0=9F=8D=AC=F0=9F=8D=AD=F0=9F=8F=B3=EF=B8=8F?= =?UTF-8?q?=E2=80=8D=E2=9A=A7?= Date: Mon, 1 Apr 2024 20:17:53 +0200 Subject: [PATCH] fix: send null for empty edited_at in mastodon api --- packages/backend/src/server/api/mastodon/converters.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts index 20fccec21..60e25c0df 100644 --- a/packages/backend/src/server/api/mastodon/converters.ts +++ b/packages/backend/src/server/api/mastodon/converters.ts @@ -83,7 +83,7 @@ export class MastoConverters { } return 'unknown'; } - + public encodeFile(f: any): Entity.Attachment { return { id: f.id, @@ -279,7 +279,8 @@ export class MastoConverters { emoji_reactions: status.emoji_reactions, bookmarked: false, quote: isQuote ? await this.convertReblog(status.reblog) : false, - edited_at: note.updatedAt?.toISOString(), + // optional chaining cannot be used, as it evaluates to undefined, not null + edited_at: note.updatedAt ? note.updatedAt.toISOString() : null, }); } }