Fix crash against Pleroma (make `latest_read_message_by_account` an optional param)

environments/review-chats-g56n7m/deployments/1581
Alex Gleason 2022-11-27 15:34:43 -06:00
rodzic 5bb30b6282
commit 6697e0191b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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
}[]