Page MenuHomePhabricator

D10670.id35739.diff
No OneTemporary

D10670.id35739.diff

diff --git a/lib/selectors/chat-selectors.js b/lib/selectors/chat-selectors.js
--- a/lib/selectors/chat-selectors.js
+++ b/lib/selectors/chat-selectors.js
@@ -70,7 +70,7 @@
export type ChatThreadItem = {
+type: 'chatThreadItem',
- +threadInfo: LegacyThreadInfo | ThreadInfo,
+ +threadInfo: ThreadInfo,
+mostRecentMessageInfo: ?MessageInfo,
+mostRecentNonLocalMessage: ?string,
+lastUpdatedTime: number,
@@ -126,7 +126,7 @@
}
function createChatThreadItem(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
messageStore: MessageStore,
messages: { +[id: string]: ?MessageInfo },
sidebarInfos: ?$ReadOnlyArray<SidebarInfo>,
diff --git a/lib/shared/ancestor-threads.js b/lib/shared/ancestor-threads.js
--- a/lib/shared/ancestor-threads.js
+++ b/lib/shared/ancestor-threads.js
@@ -9,12 +9,11 @@
} from '../selectors/thread-selectors.js';
import { threadIsPending } from '../shared/thread-utils.js';
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
import { useSelector } from '../utils/redux-utils.js';
function useAncestorThreads(
- threadInfo: LegacyThreadInfo | ThreadInfo,
-): $ReadOnlyArray<LegacyThreadInfo | ThreadInfo> {
+ threadInfo: ThreadInfo,
+): $ReadOnlyArray<ThreadInfo> {
const ancestorThreads = useSelector(ancestorThreadInfos(threadInfo.id));
const genesisThreadInfo = useSelector(
diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -451,7 +451,7 @@
}
type PendingPersonalThread = {
- +threadInfo: LegacyThreadInfo | ThreadInfo,
+ +threadInfo: ThreadInfo,
+pendingPersonalThreadUserInfo: UserInfo,
};
@@ -1288,10 +1288,9 @@
};
type ExistingThreadInfoFinder = (
params: ExistingThreadInfoFinderParams,
-) => ?(LegacyThreadInfo | ThreadInfo);
-// TODO (atul): Parameterize function once `createPendingThread` is updated.
+) => ?ThreadInfo;
function useExistingThreadInfoFinder(
- baseThreadInfo: ?(LegacyThreadInfo | ThreadInfo),
+ baseThreadInfo: ?ThreadInfo,
): ExistingThreadInfoFinder {
const threadInfos = useSelector(threadInfoSelector);
const loggedInUserInfo = useLoggedInUserInfo();
@@ -1301,9 +1300,7 @@
pendingToRealizedThreadIDsSelector(state.threadStore.threadInfos),
);
return React.useCallback(
- (
- params: ExistingThreadInfoFinderParams,
- ): ?(LegacyThreadInfo | ThreadInfo) => {
+ (params: ExistingThreadInfoFinderParams): ?ThreadInfo => {
if (!baseThreadInfo) {
return null;
}
@@ -1352,21 +1349,14 @@
})
: baseThreadInfo;
- if (updatedThread.minimallyEncoded) {
- return {
- ...updatedThread,
- currentUser: getMinimallyEncodedCurrentUser(
- updatedThread,
- viewerID,
- userInfos,
- ),
- };
- } else {
- return {
- ...updatedThread,
- currentUser: getCurrentUser(updatedThread, viewerID, userInfos),
- };
- }
+ return {
+ ...updatedThread,
+ currentUser: getMinimallyEncodedCurrentUser(
+ updatedThread,
+ viewerID,
+ userInfos,
+ ),
+ };
},
[
baseThreadInfo,
@@ -1677,11 +1667,11 @@
}
function patchThreadInfoToIncludeMentionedMembersOfParent(
- threadInfo: LegacyThreadInfo | ThreadInfo,
- parentThreadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
+ parentThreadInfo: ThreadInfo,
messageText: string,
viewerID: string,
-): LegacyThreadInfo | ThreadInfo {
+): ThreadInfo {
const members: UserIDAndUsername[] = threadInfo.members
.map(({ id, username }) =>
username ? ({ id, username }: UserIDAndUsername) : null,
diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js
--- a/lib/types/thread-types.js
+++ b/lib/types/thread-types.js
@@ -411,7 +411,7 @@
};
export type SidebarInfo = {
- +threadInfo: LegacyThreadInfo | ThreadInfo,
+ +threadInfo: ThreadInfo,
+lastUpdatedTime: number,
+mostRecentNonLocalMessage: ?string,
};
diff --git a/lib/utils/drawer-utils.react.js b/lib/utils/drawer-utils.react.js
--- a/lib/utils/drawer-utils.react.js
+++ b/lib/utils/drawer-utils.react.js
@@ -16,7 +16,7 @@
} from '../types/thread-types.js';
type WritableCommunityDrawerItemData<T> = {
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
itemChildren: $ReadOnlyArray<CommunityDrawerItemData<T>>,
hasSubchannelsButton: boolean,
labelStyle: T,
@@ -29,9 +29,7 @@
childThreadInfosMap: {
+[id: string]: $ReadOnlyArray<ThreadInfo>,
},
- communities: $ReadOnlyArray<
- LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo,
- >,
+ communities: $ReadOnlyArray<MinimallyEncodedResolvedThreadInfo>,
labelStyles: $ReadOnlyArray<LabelStyleType>,
maxDepth: number,
): $ReadOnlyArray<CommunityDrawerItemData<LabelStyleType>> {
diff --git a/lib/utils/entity-helpers.js b/lib/utils/entity-helpers.js
--- a/lib/utils/entity-helpers.js
+++ b/lib/utils/entity-helpers.js
@@ -13,18 +13,12 @@
MinimallyEncodedResolvedThreadInfo,
ThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
-import type {
- LegacyResolvedThreadInfo,
- LegacyThreadInfo,
-} from '../types/thread-types.js';
import { values } from '../utils/objects.js';
function useResolvedThreadInfos(
- threadInfos: $ReadOnlyArray<LegacyThreadInfo | ThreadInfo>,
+ threadInfos: $ReadOnlyArray<ThreadInfo>,
options?: ?UseENSNamesOptions,
-): $ReadOnlyArray<
- LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo,
-> {
+): $ReadOnlyArray<MinimallyEncodedResolvedThreadInfo> {
const entityText = React.useMemo(
() => threadInfos.map(threadInfo => threadInfo.uiName),
[threadInfos],
@@ -43,28 +37,18 @@
return (threadInfo: any);
}
const resolvedThreadEntity = withENSNames[i];
- // Branching to appease `flow`.
- if (threadInfo.minimallyEncoded) {
- return {
- ...threadInfo,
- uiName: entityTextToRawString([resolvedThreadEntity]),
- };
- } else {
- return {
- ...threadInfo,
- uiName: entityTextToRawString([resolvedThreadEntity]),
- };
- }
+ return {
+ ...threadInfo,
+ uiName: entityTextToRawString([resolvedThreadEntity]),
+ };
}),
[threadInfos, withENSNames],
);
}
function useResolvedOptionalThreadInfos(
- threadInfos: ?$ReadOnlyArray<LegacyThreadInfo | ThreadInfo>,
-): ?$ReadOnlyArray<
- LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo,
-> {
+ threadInfos: ?$ReadOnlyArray<ThreadInfo>,
+): ?$ReadOnlyArray<MinimallyEncodedResolvedThreadInfo> {
const entityText = React.useMemo(() => {
if (!threadInfos) {
return null;
@@ -99,11 +83,11 @@
function useResolvedThreadInfosObj(
threadInfosObj: {
- +[id: string]: LegacyThreadInfo | ThreadInfo,
+ +[id: string]: ThreadInfo,
},
options?: ?UseENSNamesOptions,
): {
- +[id: string]: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo,
+ +[id: string]: MinimallyEncodedResolvedThreadInfo,
} {
const threadInfosArray = React.useMemo(
() => values(threadInfosObj),
@@ -115,7 +99,7 @@
);
return React.useMemo(() => {
const obj: {
- [string]: LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo,
+ [string]: MinimallyEncodedResolvedThreadInfo,
} = {};
for (const resolvedThreadInfo of resolvedThreadInfosArray) {
obj[resolvedThreadInfo.id] = resolvedThreadInfo;
@@ -125,16 +109,16 @@
}
function useResolvedThreadInfo(
- threadInfo: LegacyThreadInfo | ThreadInfo,
-): LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo {
+ threadInfo: ThreadInfo,
+): MinimallyEncodedResolvedThreadInfo {
const resolutionInput = React.useMemo(() => [threadInfo], [threadInfo]);
const [resolvedThreadInfo] = useResolvedThreadInfos(resolutionInput);
return resolvedThreadInfo;
}
function useResolvedOptionalThreadInfo(
- threadInfo: ?LegacyThreadInfo | ?ThreadInfo,
-): ?(LegacyResolvedThreadInfo | MinimallyEncodedResolvedThreadInfo) {
+ threadInfo: ?ThreadInfo,
+): ?MinimallyEncodedResolvedThreadInfo {
const resolutionInput = React.useMemo(
() => (threadInfo ? [threadInfo] : []),
[threadInfo],

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 3:31 PM (18 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2431286
Default Alt Text
D10670.id35739.diff (8 KB)

Event Timeline