From cc45b9e2553f896d09b53dab8d8975e91fcf285c Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 14 Sep 2021 15:07:42 +0100 Subject: [PATCH] Simplify how last message is handled. --- package.json | 2 +- src/components/navigation/items/ButtonItem.tsx | 10 ++++++---- src/components/navigation/left/common.ts | 17 +---------------- yarn.lock | 8 ++++---- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 1ec562d2..38c970d9 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "react-virtuoso": "^1.10.4", "redux": "^4.1.0", "revolt-api": "0.5.3-alpha.0-patch.0", - "revolt.js": "5.1.0-alpha.0-patch.1", + "revolt.js": "5.1.0-alpha.1", "rimraf": "^3.0.2", "sass": "^1.35.1", "shade-blend-color": "^1.0.0", diff --git a/src/components/navigation/items/ButtonItem.tsx b/src/components/navigation/items/ButtonItem.tsx index ae38ba54..1f7d274c 100644 --- a/src/components/navigation/items/ButtonItem.tsx +++ b/src/components/navigation/items/ButtonItem.tsx @@ -82,8 +82,9 @@ export const UserButton = observer((props: UserProps) => { {
- {channel?.last_message && alert ? ( - (channel.last_message as { short: string }).short + {typeof channel?.last_message?.content === "string" && + alert ? ( + channel.last_message.content.slice(0, 32) ) : ( )} @@ -162,8 +163,9 @@ export const ChannelButton = observer((props: ChannelProps) => {
{channel.name}
{channel.channel_type === "Group" && (
- {channel.last_message && alert ? ( - (channel.last_message as { short: string }).short + {typeof channel.last_message?.content === "string" && + alert ? ( + channel.last_message.content.slice(0, 32) ) : (