Fix crash against Pleroma (make latest_read_message_by_account an optional param)

This commit is contained in:
Alex Gleason 2022-11-27 15:34:43 -06:00
parent 5bb30b6282
commit 6697e0191b
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 3 additions and 3 deletions

View file

@ -78,8 +78,8 @@ const ChatMessageList: React.FC<IChatMessageList> = ({ chat }) => {
const account = useOwnAccount();
const features = useFeatures();
const lastReadMessageDateString = chat.latest_read_message_by_account.find((latest) => latest.id === chat.account.id)?.date;
const myLastReadMessageDateString = chat.latest_read_message_by_account.find((latest) => latest.id === account?.id)?.date;
const lastReadMessageDateString = chat.latest_read_message_by_account?.find((latest) => latest.id === chat.account.id)?.date;
const myLastReadMessageDateString = chat.latest_read_message_by_account?.find((latest) => latest.id === account?.id)?.date;
const lastReadMessageTimestamp = lastReadMessageDateString ? new Date(lastReadMessageDateString) : null;
const myLastReadMessageTimestamp = myLastReadMessageDateString ? new Date(myLastReadMessageDateString) : null;

View file

@ -42,7 +42,7 @@ export interface IChat {
id: string
unread: boolean
}
latest_read_message_by_account: {
latest_read_message_by_account?: {
id: string,
date: string
}[]