From d3b8de8ab99d20a896606688151a9f6ac51dd65c Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Mon, 16 Oct 2023 00:30:42 +0900 Subject: [PATCH] Use source field for alwaysMarkNsfw --- megalodon/src/entities/account.ts | 1 - megalodon/src/firefish/api_client.ts | 21 ++++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/megalodon/src/entities/account.ts b/megalodon/src/entities/account.ts index ff40f75d2..0d8f34c59 100644 --- a/megalodon/src/entities/account.ts +++ b/megalodon/src/entities/account.ts @@ -31,5 +31,4 @@ export type Account = { source?: Source role?: Role mute_expires_at?: string - always_mark_nsfw?: boolean } diff --git a/megalodon/src/firefish/api_client.ts b/megalodon/src/firefish/api_client.ts index b5e8e4559..5c81dda76 100644 --- a/megalodon/src/firefish/api_client.ts +++ b/megalodon/src/firefish/api_client.ts @@ -130,14 +130,29 @@ namespace FirefishAPI { emojis: Array.isArray(u.emojis) ? u.emojis.map(e => emoji(e)) : [], moved: null, fields: u.fields.map(f => field(f)), - bot: u.isBot !== undefined ? u.isBot : null + bot: u.isBot !== undefined ? u.isBot : null, + source: { + privacy: null, + sensitive: null, + language: u.lang, + note: u.description ?? '', + fields: [] + } } } export const userDetailMe = (u: Entity.UserDetailMe): MegalodonEntity.Account => { const account = userDetail(u) - account.always_mark_nsfw = u.alwaysMarkNsfw - return account + + return Object.assign({}, account, { + source: { + privacy: null, + sensitive: u.alwaysMarkNsfw, + language: u.lang, + note: u.description ?? '', + fields: [] + } + }) } export const userPreferences = (