diff --git a/src/utils/queryHooks/timeline.ts b/src/utils/queryHooks/timeline.ts index c4dfb5a4..43227377 100644 --- a/src/utils/queryHooks/timeline.ts +++ b/src/utils/queryHooks/timeline.ts @@ -353,14 +353,23 @@ export type MutationVarsTimeline = const mutationFunction = async (params: MutationVarsTimeline) => { switch (params.type) { case 'updateStatusProperty': + let tootId = params.status.id + let pollId = params.status.poll?.id + if (params.status._remote) { + const fetched = await searchLocalStatus(params.status.uri) + if (fetched) { + tootId = fetched.id + pollId = fetched.poll?.id + } else { + return Promise.reject('Fetching for remote toot failed') + } + } + switch (params.payload.type) { case 'poll': return apiInstance({ method: params.payload.action === 'vote' ? 'post' : 'get', - url: - params.payload.action === 'vote' - ? `polls/${params.status.poll?.id}/votes` - : `polls/${params.status.poll?.id}`, + url: params.payload.action === 'vote' ? `polls/${pollId}/votes` : `polls/${pollId}`, ...(params.payload.action === 'vote' && { body: { choices: params.payload.options @@ -370,15 +379,6 @@ const mutationFunction = async (params: MutationVarsTimeline) => { }) }) default: - let tootId = params.status.id - if (params.status._remote) { - const fetched = await searchLocalStatus(params.status.uri) - if (fetched) { - tootId = fetched.id - } else { - return Promise.reject('Fetching for remote toot failed') - } - } return apiInstance({ method: 'post', url: `statuses/${tootId}/${params.payload.to ? '' : 'un'}${