From 4b23d774b6ca9aa2fdea664a8685e650dd236a3d Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 09:12:13 +0000 Subject: [PATCH] Re-insert removed comments and fix parseTitle usage --- plugins/notion/server/notion.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/notion/server/notion.ts b/plugins/notion/server/notion.ts index 8e0f5e2c69..cf71c0d10e 100644 --- a/plugins/notion/server/notion.ts +++ b/plugins/notion/server/notion.ts @@ -164,6 +164,7 @@ export class NotionClient { cursor = response.next_cursor ?? undefined; } + // Recursive fetch when direct children have their own children. await Promise.all( blocks.map(async (block) => { if ( @@ -268,12 +269,15 @@ export class NotionClient { return user.name; } + // bot belongs to a user, get the user's name. if (user.bot.owner.type === "user" && isFullUser(user.bot.owner.user)) { return user.bot.owner.user.name; } + // bot belongs to a workspace, fallback to bot's name. return user.name; } catch (error) { + // Handle the case where a user can't be found if ( error instanceof APIResponseError && error.code === APIErrorCode.ObjectNotFound @@ -309,6 +313,7 @@ export class NotionClient { } private parseEmoji(item: PageObjectResponse | DatabaseObjectResponse) { + // Other icon types return a url to download from, which we don't support. return item.icon?.type === "emoji" ? item.icon.emoji : undefined; } }