1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
xmflsct
2022-10-31 23:43:42 +01:00
parent fa0d28acd1
commit cc3d5b14e5
3 changed files with 101 additions and 21 deletions

View File

@ -293,11 +293,18 @@ export type MutationVarsTimelineUpdateStatusProperty = {
countValue: undefined
}
| {
property: 'favourited' | 'reblogged'
property: 'favourited'
currentValue: boolean
propertyCount: 'favourites_count' | 'reblogs_count'
countValue: number
}
| {
property: 'reblogged'
currentValue: boolean
propertyCount: 'favourites_count' | 'reblogs_count'
countValue: number
visibility: 'public' | 'unlisted'
}
| {
property: 'poll'
id: Mastodon.Poll['id']
@ -371,11 +378,16 @@ const mutationFunction = async (params: MutationVarsTimeline) => {
...(params.payload.type === 'vote' && { body: formData })
})
default:
const body = new FormData()
if (params.payload.property === 'reblogged') {
body.append('visibility', params.payload.visibility)
}
return apiInstance<Mastodon.Status>({
method: 'post',
url: `statuses/${params.id}/${
params.payload.currentValue ? 'un' : ''
}${MapPropertyToUrl[params.payload.property]}`
}${MapPropertyToUrl[params.payload.property]}`,
body
})
}
case 'updateAccountProperty':