Convert Instance normalizer into TypeScript

next-old
Alex Gleason 2022-03-11 12:14:32 -06:00
rodzic 37827c34d9
commit d48a9586e5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -60,7 +60,7 @@ const InstanceRecord = ImmutableRecord({
});
// Build Mastodon configuration from Pleroma instance
const pleromaToMastodonConfig = instance => {
const pleromaToMastodonConfig = (instance: ImmutableMap<string, any>) => {
return ImmutableMap({
statuses: ImmutableMap({
max_characters: instance.get('max_toot_chars'),
@ -75,10 +75,10 @@ const pleromaToMastodonConfig = instance => {
};
// Get the software's default attachment limit
const getAttachmentLimit = software => software === PLEROMA ? Infinity : 4;
const getAttachmentLimit = (software: string) => software === PLEROMA ? Infinity : 4;
// Normalize instance (Pleroma, Mastodon, etc.) to Mastodon's format
export const normalizeInstance = instance => {
export const normalizeInstance = (instance: ImmutableMap<string, any>) => {
const { software } = parseVersion(instance.get('version'));
const mastodonConfig = pleromaToMastodonConfig(instance);