From f3c5e7de5fb97ba3a259a5b435f4614c49478f2c Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 27 Dec 2021 20:57:16 -0800 Subject: [PATCH] fix: ignore falsy last_status (#2099) Fixes #2097 --- src/routes/_actions/stream/processMessage.js | 5 ++++- src/routes/_api/timelines.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/routes/_actions/stream/processMessage.js b/src/routes/_actions/stream/processMessage.js index 63bcac6e..2165b9d2 100644 --- a/src/routes/_actions/stream/processMessage.js +++ b/src/routes/_actions/stream/processMessage.js @@ -35,7 +35,10 @@ export function processMessage (instanceName, timelineName, message) { // reproduce what is done for statuses for the conversation. // // It will add new DMs as new conversations instead of updating existing threads - addStatusOrNotification(instanceName, timelineName, payload.last_status) + 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) + } break case 'filters_changed': emit('wordFiltersChanged', instanceName) diff --git a/src/routes/_api/timelines.js b/src/routes/_api/timelines.js index bbc98876..38807ab7 100644 --- a/src/routes/_api/timelines.js +++ b/src/routes/_api/timelines.js @@ -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 }) 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 } }