Remove `poll_limits` as they're not part of instancev2

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2023-10-28 16:28:53 +02:00
parent 1b31a0558e
commit b5668f1f70
1 changed files with 7 additions and 1 deletions

View File

@ -158,7 +158,6 @@ const instanceSchema = coerceObject({
max_toot_chars: z.number().optional().catch(undefined), max_toot_chars: z.number().optional().catch(undefined),
nostr: nostrSchema.optional().catch(undefined), nostr: nostrSchema.optional().catch(undefined),
pleroma: pleromaSchema, pleroma: pleromaSchema,
poll_limits: pleromaPollLimitsSchema,
registrations: registrations, registrations: registrations,
rules: filteredArray(ruleSchema), rules: filteredArray(ruleSchema),
stats: statsSchema, stats: statsSchema,
@ -229,6 +228,7 @@ const instanceV1ToV2 = coerceObject({
description, description,
description_limit, description_limit,
email, email,
poll_limits,
pleroma, pleroma,
registrations, registrations,
short_description, short_description,
@ -240,6 +240,12 @@ const instanceV1ToV2 = coerceObject({
...instance, ...instance,
configuration: { configuration: {
...configuration, ...configuration,
polls: {
max_characters_per_option: configuration.polls.max_characters_per_option ?? poll_limits.max_option_chars ?? 25,
max_expiration: configuration.polls.max_expiration ?? poll_limits.max_expiration ?? 2629746,
max_options: configuration.polls.max_options ?? poll_limits.max_options ?? 4,
min_expiration: configuration.polls.min_expiration ?? poll_limits.min_expiration ?? 300,
},
urls: { urls: {
streaming: urls.streaming_api, streaming: urls.streaming_api,
}, },