fix: ignore falsy last_status (#2099)

Fixes #2097
This commit is contained in:
Nolan Lawson 2021-12-27 20:57:16 -08:00 committed by GitHub
parent 58ff6beb26
commit f3c5e7de5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,10 @@ export function processMessage (instanceName, timelineName, message) {
// reproduce what is done for statuses for the conversation. // reproduce what is done for statuses for the conversation.
// //
// It will add new DMs as new conversations instead of updating existing threads // It will add new DMs as new conversations instead of updating existing threads
if (payload.last_status) {
// If the last_status doesn't exist, just ignore it. There's not much we can do in that case
addStatusOrNotification(instanceName, timelineName, payload.last_status) addStatusOrNotification(instanceName, timelineName, payload.last_status)
}
break break
case 'filters_changed': case 'filters_changed':
emit('wordFiltersChanged', instanceName) emit('wordFiltersChanged', instanceName)

View File

@ -75,7 +75,7 @@ export async function getTimeline (instanceName, accessToken, timeline, maxId, s
let { json: items, headers } = await getWithHeaders(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) let { json: items, headers } = await getWithHeaders(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT })
if (timeline === 'direct') { if (timeline === 'direct') {
items = items.map(item => item.last_status) items = items.map(item => item.last_status).filter(Boolean) // ignore falsy last_status'es
} }
return { items, headers } return { items, headers }
} }