diff --git a/app/javascript/mastodon/api_types/accounts.ts b/app/javascript/mastodon/api_types/accounts.ts index 03da5df8d3fe35..dc2533de33686e 100644 --- a/app/javascript/mastodon/api_types/accounts.ts +++ b/app/javascript/mastodon/api_types/accounts.ts @@ -22,7 +22,7 @@ export interface ApiAccountOtherSettingsJSON { translatable_private: boolean; link_preview: boolean; allow_quote: boolean; - emoji_reaction_policy?: + emoji_reaction_policy: | 'allow' | 'outside_only' | 'following_only' diff --git a/app/javascript/mastodon/api_types/custom_emoji.ts b/app/javascript/mastodon/api_types/custom_emoji.ts index 45439f0d5a697d..9f25e6e41079c4 100644 --- a/app/javascript/mastodon/api_types/custom_emoji.ts +++ b/app/javascript/mastodon/api_types/custom_emoji.ts @@ -9,4 +9,5 @@ export interface ApiCustomEmojiJSON { height?: number; sensitive?: boolean; aliases?: string[]; + license?: string; } diff --git a/app/javascript/mastodon/models/account.ts b/app/javascript/mastodon/models/account.ts index f20d2a2d3e1561..c44d011e604288 100644 --- a/app/javascript/mastodon/models/account.ts +++ b/app/javascript/mastodon/models/account.ts @@ -6,6 +6,7 @@ import escapeTextContentForBrowser from 'escape-html'; import type { ApiAccountFieldJSON, ApiAccountRoleJSON, + ApiAccountOtherSettingsJSON, ApiAccountJSON, } from 'mastodon/api_types/accounts'; import type { ApiCustomEmojiJSON } from 'mastodon/api_types/custom_emoji'; @@ -43,6 +44,23 @@ const AccountRoleFactory = ImmutableRecord({ name: '', }); +// AccountOtherSettings +export type AccountOtherSettingsShape = ApiAccountOtherSettingsJSON; +export type AccountOtherSettings = RecordOf; + +const AccountOtherSettingsFactory = ImmutableRecord({ + noindex: false, + noai: true, + hide_network: false, + hide_followers_count: false, + hide_following_count: false, + hide_statuses_count: false, + translatable_private: false, + link_preview: true, + allow_quote: true, + emoji_reaction_policy: 'allow', +}); + // Account export interface AccountShape extends Required< @@ -93,6 +111,8 @@ export const accountDefaultValues: AccountShape = { memorial: false, limited: false, moved: null, + other_settings: AccountOtherSettingsFactory(), + subscribable: true, }; const AccountFactory = ImmutableRecord(accountDefaultValues); diff --git a/app/javascript/mastodon/models/custom_emoji.ts b/app/javascript/mastodon/models/custom_emoji.ts index 76479f3aebf54e..96ab4bc6127761 100644 --- a/app/javascript/mastodon/models/custom_emoji.ts +++ b/app/javascript/mastodon/models/custom_emoji.ts @@ -12,4 +12,9 @@ export const CustomEmojiFactory = Record({ url: '', category: '', visible_in_picker: false, + width: 32, + height: 32, + sensitive: false, + aliases: [], + license: '', }); diff --git a/app/models/concerns/account_other_settings.rb b/app/models/concerns/account_other_settings.rb index a4655e5b727b79..a351fce1e31ce3 100644 --- a/app/models/concerns/account_other_settings.rb +++ b/app/models/concerns/account_other_settings.rb @@ -97,26 +97,14 @@ def public_settings 'translatable_private' => translatable_private?, 'link_preview' => link_preview?, 'allow_quote' => allow_quote?, + 'emoji_reaction_policy' => Setting.enable_emoji_reaction ? emoji_reaction_policy : :block, } - if Setting.enable_emoji_reaction - config = config.merge({ - 'emoji_reaction_policy' => emoji_reaction_policy, - }) - end config = config.merge(settings) if settings.present? config end def public_settings_for_local - config = public_settings - - unless Setting.enable_emoji_reaction - config = config.merge({ - 'emoji_reaction_policy' => :block, - }) - end - - config + public_settings end end end