Skip to content

Commit

Permalink
Use source field for alwaysMarkNsfw
Browse files Browse the repository at this point in the history
  • Loading branch information
h3poteto committed Oct 15, 2023
1 parent d529d51 commit d3b8de8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
1 change: 0 additions & 1 deletion megalodon/src/entities/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ export type Account = {
source?: Source
role?: Role
mute_expires_at?: string
always_mark_nsfw?: boolean
}
21 changes: 18 additions & 3 deletions megalodon/src/firefish/api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down

0 comments on commit d3b8de8

Please sign in to comment.