Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3406653
D3098.id9536.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3098.id9536.diff
View Options
diff --git a/web/chat/chat-thread-list-item.react.js b/web/chat/chat-thread-list-item.react.js
--- a/web/chat/chat-thread-list-item.react.js
+++ b/web/chat/chat-thread-list-item.react.js
@@ -23,15 +23,28 @@
+item: ChatThreadItem,
+setModal: (modal: ?React.Node) => void,
};
+
+function useLastActiveTime(item: ChatThreadItem): string {
+ const timeZone = useSelector(state => state.timeZone);
+ const lastUpdatedTimes = item.sidebars.map(sidebar => {
+ if (sidebar.type === 'sidebar') {
+ return sidebar.lastUpdatedTime;
+ } else {
+ return 0;
+ }
+ });
+
+ const recentLastTime = Math.max(item.lastUpdatedTime, ...lastUpdatedTimes);
+ return shortAbsoluteDate(recentLastTime, timeZone);
+}
+
function ChatThreadListItem(props: Props): React.Node {
const { item, setModal } = props;
const { threadInfo } = item;
const threadID = item.threadInfo.id;
const ancestorThreads = useAncestorThreads(threadInfo);
const onClick = useOnClickThread(threadID);
-
- const timeZone = useSelector(state => state.timeZone);
- const lastActivity = shortAbsoluteDate(item.lastUpdatedTime, timeZone);
+ const lastActivity = useLastActiveTime(item);
const active = useThreadIsActive(threadID);
const containerClassName = React.useMemo(
diff --git a/web/chat/sidebar-item.react.js b/web/chat/sidebar-item.react.js
--- a/web/chat/sidebar-item.react.js
+++ b/web/chat/sidebar-item.react.js
@@ -4,9 +4,7 @@
import * as React from 'react';
import type { SidebarInfo } from 'lib/types/thread-types';
-import { shortAbsoluteDate } from 'lib/utils/date-utils';
-import { useSelector } from '../redux/redux-utils';
import { useOnClickThread } from '../selectors/nav-selectors';
import SWMansionIcon from '../SWMansionIcon.react';
import css from './chat-thread-list.css';
@@ -15,16 +13,12 @@
+sidebarInfo: SidebarInfo,
};
function SidebarItem(props: Props): React.Node {
- const { threadInfo, lastUpdatedTime } = props.sidebarInfo;
+ const { threadInfo } = props.sidebarInfo;
const threadID = threadInfo.id;
-
const onClick = useOnClickThread(threadID);
-
- const timeZone = useSelector(state => state.timeZone);
- const lastActivity = shortAbsoluteDate(lastUpdatedTime, timeZone);
-
const { unread } = threadInfo.currentUser;
const unreadCls = classNames(css.sidebarTitle, { [css.unread]: unread });
+
return (
<>
<SWMansionIcon icon="right-angle-arrow" size={28} />
@@ -32,14 +26,6 @@
<a className={css.threadButtonSidebar} onClick={onClick}>
<div className={css.threadRow}>
<div className={unreadCls}>{threadInfo.uiName}</div>
- <div
- className={classNames([
- css.sidebarLastActivity,
- unread ? css.black : css.dark,
- ])}
- >
- {lastActivity}
- </div>
</div>
</a>
</>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 5, 2:45 AM (9 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615668
Default Alt Text
D3098.id9536.diff (2 KB)
Attached To
Mode
D3098: [web] [remove] lastActivity from thread
Attached
Detach File
Event Timeline
Log In to Comment