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; } }