diff --git a/web/chat/chat-thread-list-item.react.js b/web/chat/chat-thread-list-item.react.js
index 177d33892..6a76d8294 100644
--- a/web/chat/chat-thread-list-item.react.js
+++ b/web/chat/chat-thread-list-item.react.js
@@ -1,151 +1,157 @@
// @flow
import classNames from 'classnames';
import * as React from 'react';
import type { ChatThreadItem } from 'lib/selectors/chat-selectors';
import { useAncestorThreads } from 'lib/shared/ancestor-threads';
import { shortAbsoluteDate } from 'lib/utils/date-utils';
import { useSelector } from '../redux/redux-utils';
import {
useOnClickThread,
useThreadIsActive,
} from '../selectors/nav-selectors';
import SWMansionIcon from '../SWMansionIcon.react';
import ChatThreadListItemMenu from './chat-thread-list-item-menu.react';
import ChatThreadListSeeMoreSidebars from './chat-thread-list-see-more-sidebars.react';
import ChatThreadListSidebar from './chat-thread-list-sidebar.react';
import css from './chat-thread-list.css';
import MessagePreview from './message-preview.react';
type Props = {
+item: ChatThreadItem,
+setModal: (modal: ?React.Node) => void,
};
function ChatThreadListItem(props: Props): React.Node {
const { item, setModal } = props;
- const { threadInfo, lastUpdatedTimeIncludingSidebars } = item;
- const threadID = item.threadInfo.id;
+ const {
+ threadInfo,
+ lastUpdatedTimeIncludingSidebars,
+ mostRecentNonLocalMessage,
+ mostRecentMessageInfo,
+ } = item;
+ const { id: threadID, currentUser } = threadInfo;
+
const ancestorThreads = useAncestorThreads(threadInfo);
const onClick = useOnClickThread(item.threadInfo);
const timeZone = useSelector(state => state.timeZone);
const lastActivity = shortAbsoluteDate(
lastUpdatedTimeIncludingSidebars,
timeZone,
);
const active = useThreadIsActive(threadID);
const containerClassName = React.useMemo(
() =>
classNames({
[css.thread]: true,
[css.activeThread]: active,
}),
[active],
);
- const { unread } = item.threadInfo.currentUser;
+ const { unread } = currentUser;
const titleClassName = React.useMemo(
() =>
classNames({
[css.title]: true,
[css.unread]: unread,
}),
[unread],
);
const lastActivityClassName = React.useMemo(
() =>
classNames({
[css.lastActivity]: true,
[css.unread]: unread,
[css.dark]: !unread,
}),
[unread],
);
const breadCrumbsClassName = React.useMemo(
() =>
classNames(css.breadCrumbs, {
[css.unread]: unread,
}),
[unread],
);
const { color } = item.threadInfo;
const colorSplotchStyle = React.useMemo(
() => ({ backgroundColor: `#${color}` }),
[color],
);
const sidebars = item.sidebars.map(sidebarItem => {
if (sidebarItem.type === 'sidebar') {
const { type, ...sidebarInfo } = sidebarItem;
return (