From 5d1bfd2e50bda6c1fe26fe8c0d11f528dd7a04d9 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 5 Oct 2023 17:37:44 +0200 Subject: [PATCH] [mastodon-client] Fix handling of posts with empty cw / text field --- packages/backend/src/server/api/mastodon/helpers/note.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/helpers/note.ts b/packages/backend/src/server/api/mastodon/helpers/note.ts index a81a88385..4118c12c2 100644 --- a/packages/backend/src/server/api/mastodon/helpers/note.ts +++ b/packages/backend/src/server/api/mastodon/helpers/note.ts @@ -318,9 +318,9 @@ export class NoteHelpers { public static normalizeComposeOptions(body: any): MastodonEntity.StatusCreationRequest { const result: MastodonEntity.StatusCreationRequest = {}; - if (body.status !== null) + if (body.status !== null && body.status.trim().length > 0) result.text = body.status; - if (body.spoiler_text !== null) + if (body.spoiler_text !== null && body.spoiler_text.trim().length > 0) result.spoiler_text = body.spoiler_text; if (body.visibility !== null) result.visibility = VisibilityConverter.decode(body.visibility); @@ -352,9 +352,9 @@ export class NoteHelpers { public static normalizeEditOptions(body: any): MastodonEntity.StatusEditRequest { const result: MastodonEntity.StatusEditRequest = {}; - if (body.status !== null) + if (body.status !== null && body.status.trim().length > 0) result.text = body.status; - if (body.spoiler_text !== null) + if (body.spoiler_text !== null && body.spoiler_text.trim().length > 0) result.spoiler_text = body.spoiler_text; if (body.language !== null) result.language = body.language;