fix status fetching

This commit is contained in:
Henry Jameson 2026-06-16 16:37:47 +03:00
commit e5c27fccc6

View file

@ -524,42 +524,33 @@ export const fetchConversation = ({ id, credentials }) =>
url: MASTODON_STATUS_CONTEXT_URL(id),
credentials,
})
.then((data) => {
if (data.ok) {
return data
}
throw new Error('Error fetching timeline', data)
})
.then(({ ancestors, descendants }) => ({
ancestors: ancestors.map(parseStatus),
descendants: descendants.map(parseStatus),
}))
.catch((error) => {
throw new Error('Error fetching timeline', error)
})
export const fetchStatus = ({ id, credentials }) =>
promisedRequest({
url: MASTODON_STATUS_URL(id),
credentials,
})
.then((data) => {
if (data.ok) {
return data
}
throw new Error('Error fetching timeline', { cause: data })
})
.then((data) => parseStatus(data))
.catch((error) => {
throw new Error('Error fetching timeline', error)
})
export const fetchStatusSource = ({ id, credentials }) =>
promisedRequest({
url: MASTODON_STATUS_SOURCE_URL(id),
credentials,
})
.then((data) => {
if (data.ok) {
return data
}
throw new Error('Error fetching source', { cause: data })
})
.then((data) => parseSource(data))
.catch((error) => {
throw new Error('Error fetching timeline', error)
})
export const fetchStatusHistory = ({ status, credentials }) =>
promisedRequest({
@ -1281,17 +1272,14 @@ export const search2 = ({
url,
credentials,
})
.then((data) => {
if (data.ok) {
return data
}
throw new Error('Error fetching search result', data)
})
.then((data) => {
data.accounts = data.accounts.slice(0, limit).map((u) => parseUser(u))
data.statuses = data.statuses.slice(0, limit).map((s) => parseStatus(s))
return data
})
.catch((error) => {
throw new Error('Error fetching timeline', error)
})
}
export const fetchKnownDomains = ({ credentials }) =>