From 4ad507945a65d9a418038188dfdbedc1d923ff52 Mon Sep 17 00:00:00 2001 From: Louis Grasset Date: Wed, 1 Nov 2023 13:18:55 +0100 Subject: [PATCH] fix: simplify conditions --- src/helpers/tweet/split-tweet-text.ts | 6 ++---- src/services/bluesky-sender.service.ts | 10 ++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/helpers/tweet/split-tweet-text.ts b/src/helpers/tweet/split-tweet-text.ts index 1f70a61..0289abb 100644 --- a/src/helpers/tweet/split-tweet-text.ts +++ b/src/helpers/tweet/split-tweet-text.ts @@ -68,10 +68,8 @@ const splitTweetText = async ( return [text + quotedStatusLinkSection]; } } - } else { - if (text!.length <= maxChunkSize) { - return [text!]; - } + } else if (text!.length <= maxChunkSize) { + return [text!]; } return buildChunks( diff --git a/src/services/bluesky-sender.service.ts b/src/services/bluesky-sender.service.ts index 3856c41..24ccb98 100644 --- a/src/services/bluesky-sender.service.ts +++ b/src/services/bluesky-sender.service.ts @@ -157,12 +157,10 @@ export const blueskySenderService = async ( $type: "app.bsky.embed.recordWithMedia", }; } - } else { - if (Object.keys(mediaRecord).length) { - embed = { - ...mediaRecord.media, - }; - } + } else if (Object.keys(mediaRecord).length) { + embed = { + ...mediaRecord.media, + }; } if (Object.keys(embed).length) {