1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Support max_toot_chars

See this commit of how to supply this value in API response. `instance_serializer.rb`

2bf275ba3b
This commit is contained in:
Zhiyuan Zheng
2021-02-05 13:45:02 +01:00
parent 29f2bf7457
commit 700b9ad433
6 changed files with 46 additions and 15 deletions

View File

@ -13,6 +13,7 @@ export type InstanceLocal = {
url: string
token: string
uri: Mastodon.Instance['uri']
max_toot_chars: number
account: {
id: Mastodon.Account['id']
acct: Mastodon.Account['acct']
@ -54,11 +55,13 @@ export const localAddInstance = createAsyncThunk(
url,
token,
uri,
max_toot_chars = 500,
appData
}: {
url: InstanceLocal['url']
token: InstanceLocal['token']
uri: Mastodon.Instance['uri']
max_toot_chars?: number
appData: InstanceLocal['appData']
}): Promise<{ type: 'add' | 'overwrite'; data: InstanceLocal }> => {
const { store } = require('@root/store')
@ -107,6 +110,7 @@ export const localAddInstance = createAsyncThunk(
url,
token,
uri,
max_toot_chars,
account: {
id,
acct,
@ -273,6 +277,10 @@ export const getLocalUri = ({ instances: { local } }: RootState) =>
local.activeIndex !== null
? local.instances[local.activeIndex].uri
: undefined
export const getLocalMaxTootChar = ({ instances: { local } }: RootState) =>
local.activeIndex !== null
? local.instances[local.activeIndex].max_toot_chars
: 500
export const getLocalAccount = ({ instances: { local } }: RootState) =>
local.activeIndex !== null
? local.instances[local.activeIndex].account