Fix test
This commit is contained in:
parent
52dac50826
commit
7e088863b4
5 changed files with 29 additions and 15 deletions
|
@ -22,7 +22,7 @@ export interface ApiAccountOtherSettingsJSON {
|
||||||
translatable_private: boolean;
|
translatable_private: boolean;
|
||||||
link_preview: boolean;
|
link_preview: boolean;
|
||||||
allow_quote: boolean;
|
allow_quote: boolean;
|
||||||
emoji_reaction_policy?:
|
emoji_reaction_policy:
|
||||||
| 'allow'
|
| 'allow'
|
||||||
| 'outside_only'
|
| 'outside_only'
|
||||||
| 'following_only'
|
| 'following_only'
|
||||||
|
|
|
@ -9,4 +9,5 @@ export interface ApiCustomEmojiJSON {
|
||||||
height?: number;
|
height?: number;
|
||||||
sensitive?: boolean;
|
sensitive?: boolean;
|
||||||
aliases?: string[];
|
aliases?: string[];
|
||||||
|
license?: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import escapeTextContentForBrowser from 'escape-html';
|
||||||
import type {
|
import type {
|
||||||
ApiAccountFieldJSON,
|
ApiAccountFieldJSON,
|
||||||
ApiAccountRoleJSON,
|
ApiAccountRoleJSON,
|
||||||
|
ApiAccountOtherSettingsJSON,
|
||||||
ApiAccountJSON,
|
ApiAccountJSON,
|
||||||
} from 'mastodon/api_types/accounts';
|
} from 'mastodon/api_types/accounts';
|
||||||
import type { ApiCustomEmojiJSON } from 'mastodon/api_types/custom_emoji';
|
import type { ApiCustomEmojiJSON } from 'mastodon/api_types/custom_emoji';
|
||||||
|
@ -43,6 +44,23 @@ const AccountRoleFactory = ImmutableRecord<AccountRoleShape>({
|
||||||
name: '',
|
name: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// AccountOtherSettings
|
||||||
|
export type AccountOtherSettingsShape = ApiAccountOtherSettingsJSON;
|
||||||
|
export type AccountOtherSettings = RecordOf<AccountOtherSettingsShape>;
|
||||||
|
|
||||||
|
const AccountOtherSettingsFactory = ImmutableRecord<AccountOtherSettingsShape>({
|
||||||
|
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
|
// Account
|
||||||
export interface AccountShape
|
export interface AccountShape
|
||||||
extends Required<
|
extends Required<
|
||||||
|
@ -93,6 +111,8 @@ export const accountDefaultValues: AccountShape = {
|
||||||
memorial: false,
|
memorial: false,
|
||||||
limited: false,
|
limited: false,
|
||||||
moved: null,
|
moved: null,
|
||||||
|
other_settings: AccountOtherSettingsFactory(),
|
||||||
|
subscribable: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const AccountFactory = ImmutableRecord<AccountShape>(accountDefaultValues);
|
const AccountFactory = ImmutableRecord<AccountShape>(accountDefaultValues);
|
||||||
|
|
|
@ -12,4 +12,9 @@ export const CustomEmojiFactory = Record<CustomEmojiShape>({
|
||||||
url: '',
|
url: '',
|
||||||
category: '',
|
category: '',
|
||||||
visible_in_picker: false,
|
visible_in_picker: false,
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
sensitive: false,
|
||||||
|
aliases: [],
|
||||||
|
license: '',
|
||||||
});
|
});
|
||||||
|
|
|
@ -97,26 +97,14 @@ module AccountOtherSettings
|
||||||
'translatable_private' => translatable_private?,
|
'translatable_private' => translatable_private?,
|
||||||
'link_preview' => link_preview?,
|
'link_preview' => link_preview?,
|
||||||
'allow_quote' => allow_quote?,
|
'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 = config.merge(settings) if settings.present?
|
||||||
config
|
config
|
||||||
end
|
end
|
||||||
|
|
||||||
def public_settings_for_local
|
def public_settings_for_local
|
||||||
config = public_settings
|
public_settings
|
||||||
|
|
||||||
unless Setting.enable_emoji_reaction
|
|
||||||
config = config.merge({
|
|
||||||
'emoji_reaction_policy' => :block,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
config
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue