Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3528425
D10677.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
19 KB
Referenced Files
None
Subscribers
None
D10677.diff
View Options
diff --git a/lib/components/chat-mention-provider.react.js b/lib/components/chat-mention-provider.react.js
--- a/lib/components/chat-mention-provider.react.js
+++ b/lib/components/chat-mention-provider.react.js
@@ -13,7 +13,6 @@
import type {
ChatMentionCandidate,
ChatMentionCandidatesObj,
- LegacyThreadInfo,
} from '../types/thread-types.js';
import { useResolvedThreadInfosObj } from '../utils/entity-helpers.js';
import { getNameForThreadEntity } from '../utils/entity-text.js';
@@ -24,7 +23,7 @@
};
export type ChatMentionContextType = {
+getChatMentionSearchIndex: (
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
) => SentencePrefixSearchIndex,
+communityThreadIDForGenesisThreads: { +[id: string]: string },
+chatMentionCandidatesObj: ChatMentionCandidatesObj,
@@ -46,7 +45,7 @@
const searchIndices = useChatMentionSearchIndex(chatMentionCandidatesObj);
const getChatMentionSearchIndex = React.useCallback(
- (threadInfo: LegacyThreadInfo | ThreadInfo) => {
+ (threadInfo: ThreadInfo) => {
if (threadInfo.community === genesis.id) {
return searchIndices[communityThreadIDForGenesisThreads[threadInfo.id]];
}
diff --git a/lib/hooks/chat-mention-hooks.js b/lib/hooks/chat-mention-hooks.js
--- a/lib/hooks/chat-mention-hooks.js
+++ b/lib/hooks/chat-mention-hooks.js
@@ -9,10 +9,7 @@
} from '../components/chat-mention-provider.react.js';
import genesis from '../facts/genesis.js';
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
-import type {
- ChatMentionCandidates,
- LegacyThreadInfo,
-} from '../types/thread-types.js';
+import type { ChatMentionCandidates } from '../types/thread-types.js';
function useChatMentionContext(): ChatMentionContextType {
const context = React.useContext(ChatMentionContext);
@@ -22,7 +19,7 @@
}
function useThreadChatMentionCandidates(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
): ChatMentionCandidates {
const { communityThreadIDForGenesisThreads, chatMentionCandidatesObj } =
useChatMentionContext();
diff --git a/lib/hooks/child-threads.js b/lib/hooks/child-threads.js
--- a/lib/hooks/child-threads.js
+++ b/lib/hooks/child-threads.js
@@ -18,12 +18,11 @@
ThreadInfo,
RawThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
import { useSelector } from '../utils/redux-utils.js';
type ThreadFilter = {
- +predicate?: (thread: LegacyThreadInfo | ThreadInfo) => boolean,
+ +predicate?: (thread: ThreadInfo) => boolean,
+searchText?: string,
};
@@ -44,7 +43,7 @@
}, [childThreads, predicate]);
const filterSubchannels = React.useCallback(
- (thread: ?(RawThreadInfo | LegacyThreadInfo | ThreadInfo)) => {
+ (thread: ?(RawThreadInfo | ThreadInfo)) => {
const candidateThreadID = thread?.id;
if (!candidateThreadID) {
return false;
diff --git a/lib/hooks/promote-sidebar.react.js b/lib/hooks/promote-sidebar.react.js
--- a/lib/hooks/promote-sidebar.react.js
+++ b/lib/hooks/promote-sidebar.react.js
@@ -16,13 +16,12 @@
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
import { threadTypes } from '../types/thread-types-enum.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
import { useSelector } from '../utils/redux-utils.js';
function canPromoteSidebar(
- sidebarThreadInfo: LegacyThreadInfo | ThreadInfo,
- parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo,
+ sidebarThreadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
): boolean {
if (!threadIsSidebar(sidebarThreadInfo)) {
return false;
@@ -46,7 +45,7 @@
};
function usePromoteSidebar(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
onError?: () => mixed,
): PromoteSidebarType {
const dispatchActionPromise = useDispatchActionPromise();
@@ -57,9 +56,8 @@
const loadingStatus = useSelector(loadingStatusSelector);
const { parentThreadID } = threadInfo;
- const parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo = useSelector(
- state =>
- parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
+ const parentThreadInfo: ?ThreadInfo = useSelector(state =>
+ parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
);
const canPromote = canPromoteSidebar(threadInfo, parentThreadInfo);
diff --git a/lib/hooks/relationship-prompt.js b/lib/hooks/relationship-prompt.js
--- a/lib/hooks/relationship-prompt.js
+++ b/lib/hooks/relationship-prompt.js
@@ -13,7 +13,6 @@
type RelationshipAction,
relationshipActions,
} from '../types/relationship-types.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
import type { UserInfo } from '../types/user-types.js';
import { useLegacyAshoatKeyserverCall } from '../utils/action-utils.js';
import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
@@ -32,7 +31,7 @@
};
function useRelationshipPrompt(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
onErrorCallback?: () => void,
pendingPersonalThreadUserInfo?: ?UserInfo,
): RelationshipPromptData {
diff --git a/lib/hooks/search-threads.js b/lib/hooks/search-threads.js
--- a/lib/hooks/search-threads.js
+++ b/lib/hooks/search-threads.js
@@ -14,7 +14,7 @@
ThreadInfo,
RawThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
-import type { LegacyThreadInfo, SidebarInfo } from '../types/thread-types.js';
+import type { SidebarInfo } from '../types/thread-types.js';
import { useSelector } from '../utils/redux-utils.js';
export type ThreadSearchState = {
@@ -31,7 +31,7 @@
};
function useSearchThreads<U: SidebarInfo | ChatThreadItem>(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
childThreadInfos: $ReadOnlyArray<U>,
): SearchThreadsResult<U> {
const [searchState, setSearchState] = React.useState<ThreadSearchState>({
@@ -91,7 +91,7 @@
}
function useSearchSidebars(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
): SearchThreadsResult<SidebarInfo> {
const childThreadInfos = useSelector(
state => sidebarInfoSelector(state)[threadInfo.id] ?? [],
@@ -100,10 +100,10 @@
}
function useSearchSubchannels(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
): SearchThreadsResult<ChatThreadItem> {
const filterFunc = React.useCallback(
- (thread: ?(LegacyThreadInfo | ThreadInfo | RawThreadInfo)) =>
+ (thread: ?(ThreadInfo | RawThreadInfo)) =>
threadIsChannel(thread) && thread?.parentThreadID === threadInfo.id,
[threadInfo.id],
);
diff --git a/lib/hooks/toggle-unread-status.js b/lib/hooks/toggle-unread-status.js
--- a/lib/hooks/toggle-unread-status.js
+++ b/lib/hooks/toggle-unread-status.js
@@ -11,11 +11,10 @@
SetThreadUnreadStatusRequest,
} from '../types/activity-types.js';
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
function useToggleUnreadStatus(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
mostRecentNonLocalMessage: ?string,
afterAction: () => void,
): () => void {
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
@@ -45,7 +45,6 @@
maxReadSidebars,
maxUnreadSidebars,
type SidebarInfo,
- type LegacyThreadInfo,
} from '../types/thread-types.js';
import type {
AccountUserInfo,
@@ -98,7 +97,7 @@
}
function getMostRecentMessageInfo(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
messageStore: MessageStore,
messages: { +[id: string]: ?MessageInfo },
): ?MessageInfo {
@@ -117,7 +116,7 @@
}
function getLastUpdatedTime(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
mostRecentMessageInfo: ?MessageInfo,
): number {
return mostRecentMessageInfo
@@ -232,9 +231,7 @@
}
function useFilteredChatListData(
- filterFunction: (
- threadInfo: ?(LegacyThreadInfo | ThreadInfo | RawThreadInfo),
- ) => boolean,
+ filterFunction: (threadInfo: ?(ThreadInfo | RawThreadInfo)) => boolean,
): $ReadOnlyArray<ChatThreadItem> {
const threadInfos = useSelector(threadInfoSelector);
const messageInfos = useSelector(messageInfoSelector);
@@ -620,7 +617,7 @@
export type UseMessageListDataArgs = {
+searching: boolean,
+userInfoInputArray: $ReadOnlyArray<AccountUserInfo>,
- +threadInfo: ?LegacyThreadInfo | ?ThreadInfo,
+ +threadInfo: ?ThreadInfo,
};
function useMessageListData({
diff --git a/lib/selectors/nav-selectors.js b/lib/selectors/nav-selectors.js
--- a/lib/selectors/nav-selectors.js
+++ b/lib/selectors/nav-selectors.js
@@ -18,10 +18,7 @@
} from '../types/minimally-encoded-thread-permissions-types.js';
import type { BaseNavInfo } from '../types/nav-types.js';
import type { BaseAppState } from '../types/redux-types.js';
-import type {
- LegacyThreadInfo,
- RelativeMemberInfo,
-} from '../types/thread-types';
+import type { RelativeMemberInfo } from '../types/thread-types';
import type { UserInfo } from '../types/user-types.js';
import { getConfig } from '../utils/config.js';
import { values } from '../utils/objects.js';
@@ -123,7 +120,7 @@
}
function useThreadSearchIndex(
- threadInfos: $ReadOnlyArray<RawThreadInfo | LegacyThreadInfo | ThreadInfo>,
+ threadInfos: $ReadOnlyArray<RawThreadInfo | ThreadInfo>,
): SearchIndex {
const userInfos = useSelector(state => state.userStore.userInfos);
const viewerID = useSelector(
diff --git a/lib/shared/avatar-utils.js b/lib/shared/avatar-utils.js
--- a/lib/shared/avatar-utils.js
+++ b/lib/shared/avatar-utils.js
@@ -21,10 +21,7 @@
RawThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
import { threadTypes } from '../types/thread-types-enum.js';
-import type {
- LegacyRawThreadInfo,
- LegacyThreadInfo,
-} from '../types/thread-types.js';
+import type { LegacyRawThreadInfo } from '../types/thread-types.js';
import type { UserInfos } from '../types/user-types.js';
import { useSelector } from '../utils/redux-utils.js';
import { ashoatKeyserverID } from '../utils/validation-utils.js';
@@ -277,11 +274,7 @@
}
function getUserAvatarForThread(
- threadInfo:
- | LegacyRawThreadInfo
- | RawThreadInfo
- | LegacyThreadInfo
- | ThreadInfo,
+ threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo,
viewerID: ?string,
userInfos: UserInfos,
): ClientAvatar {
@@ -307,8 +300,8 @@
}
function getAvatarForThread(
- thread: RawThreadInfo | LegacyThreadInfo | ThreadInfo,
- containingThreadInfo: ?LegacyThreadInfo | ?ThreadInfo,
+ thread: RawThreadInfo | ThreadInfo,
+ containingThreadInfo: ?ThreadInfo,
): ClientAvatar {
if (thread.avatar) {
return thread.avatar;
@@ -323,9 +316,7 @@
return getDefaultAvatar(thread.id, thread.color);
}
-function useAvatarForThread(
- thread: RawThreadInfo | LegacyThreadInfo | ThreadInfo,
-): ClientAvatar {
+function useAvatarForThread(thread: RawThreadInfo | ThreadInfo): ClientAvatar {
const containingThreadID = thread.containingThreadID;
const containingThreadInfo = useSelector(state =>
containingThreadID ? threadInfoSelector(state)[containingThreadID] : null,
diff --git a/lib/shared/edit-messages-utils.js b/lib/shared/edit-messages-utils.js
--- a/lib/shared/edit-messages-utils.js
+++ b/lib/shared/edit-messages-utils.js
@@ -16,7 +16,6 @@
import { messageTypes } from '../types/message-types-enum.js';
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
import { useSelector } from '../utils/redux-utils.js';
@@ -52,7 +51,7 @@
}
function useCanEditMessage(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
targetMessageInfo: ComposableMessageInfo | RobotextMessageInfo,
): boolean {
const currentUserInfo = useSelector(state => state.currentUserInfo);
diff --git a/lib/shared/inline-engagement-utils.js b/lib/shared/inline-engagement-utils.js
--- a/lib/shared/inline-engagement-utils.js
+++ b/lib/shared/inline-engagement-utils.js
@@ -2,11 +2,8 @@
import type { ReactionInfo } from '../selectors/chat-selectors.js';
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
-function getInlineEngagementSidebarText(
- threadInfo: ?LegacyThreadInfo | ?ThreadInfo,
-): string {
+function getInlineEngagementSidebarText(threadInfo: ?ThreadInfo): string {
if (!threadInfo) {
return '';
}
diff --git a/lib/shared/mention-utils.js b/lib/shared/mention-utils.js
--- a/lib/shared/mention-utils.js
+++ b/lib/shared/mention-utils.js
@@ -14,7 +14,6 @@
import { threadTypes } from '../types/thread-types-enum.js';
import type {
ChatMentionCandidates,
- LegacyThreadInfo,
RelativeMemberInfo,
} from '../types/thread-types.js';
import { chatNameMaxLength, idSchemaRegex } from '../utils/validation-utils.js';
@@ -185,8 +184,8 @@
}
function useUserMentionsCandidates(
- threadInfo: LegacyThreadInfo | ThreadInfo,
- parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo,
+ threadInfo: ThreadInfo,
+ parentThreadInfo: ?ThreadInfo,
): $ReadOnlyArray<RelativeMemberInfo> {
return React.useMemo(() => {
if (threadInfo.type !== threadTypes.SIDEBAR) {
diff --git a/lib/shared/reaction-utils.js b/lib/shared/reaction-utils.js
--- a/lib/shared/reaction-utils.js
+++ b/lib/shared/reaction-utils.js
@@ -14,7 +14,6 @@
} from '../types/message-types.js';
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
import { useSelector } from '../utils/redux-utils.js';
function useViewerAlreadySelectedMessageReactions(
@@ -75,7 +74,7 @@
}
function useCanCreateReactionFromMessage(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
targetMessageInfo: ComposableMessageInfo | RobotextMessageInfo,
): boolean {
const targetMessageCreatorRelationship = useSelector(
diff --git a/lib/shared/search-utils.js b/lib/shared/search-utils.js
--- a/lib/shared/search-utils.js
+++ b/lib/shared/search-utils.js
@@ -30,7 +30,6 @@
import { userRelationshipStatus } from '../types/relationship-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
import { type ThreadType, threadTypes } from '../types/thread-types-enum.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
import type {
AccountUserInfo,
GlobalAccountUserInfo,
@@ -61,9 +60,9 @@
},
+excludeUserIDs: $ReadOnlyArray<string>,
+userInfo: AccountUserInfo | GlobalAccountUserInfo,
- +parentThreadInfo: ?LegacyThreadInfo | ?ThreadInfo,
- +communityThreadInfo: ?LegacyThreadInfo | ?ThreadInfo,
- +containingThreadInfo: ?LegacyThreadInfo | ?ThreadInfo,
+ +parentThreadInfo: ?ThreadInfo,
+ +communityThreadInfo: ?ThreadInfo,
+ +containingThreadInfo: ?ThreadInfo,
}) {
const { id } = userInfo;
if (excludeUserIDs.includes(id) || id in results) {
@@ -99,8 +98,8 @@
+userInfos: { +[id: string]: AccountUserInfo },
+excludeUserIDs: $ReadOnlyArray<string>,
+includeServerSearchUsers?: $ReadOnlyArray<GlobalAccountUserInfo>,
- +inputParentThreadInfo?: ?LegacyThreadInfo | ?ThreadInfo,
- +inputCommunityThreadInfo?: ?LegacyThreadInfo | ?ThreadInfo,
+ +inputParentThreadInfo?: ?ThreadInfo,
+ +inputCommunityThreadInfo?: ?ThreadInfo,
+threadType?: ?ThreadType,
}): UserListItem[] {
const memoizedUserInfos = React.useMemo(() => values(userInfos), [userInfos]);
diff --git a/lib/shared/user-utils.js b/lib/shared/user-utils.js
--- a/lib/shared/user-utils.js
+++ b/lib/shared/user-utils.js
@@ -6,10 +6,7 @@
ThreadInfo,
RawThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
-import type {
- LegacyThreadInfo,
- ServerThreadInfo,
-} from '../types/thread-types.js';
+import type { ServerThreadInfo } from '../types/thread-types.js';
import type { UserInfo } from '../types/user-types.js';
import { useSelector } from '../utils/redux-utils.js';
@@ -36,7 +33,7 @@
}
function useKeyserverAdmin(
- community: LegacyThreadInfo | ThreadInfo | RawThreadInfo | ServerThreadInfo,
+ community: ThreadInfo | RawThreadInfo | ServerThreadInfo,
): ?UserInfo {
const userInfos = useSelector(state => state.userStore.userInfos);
// This hack only works as long as there is only one admin
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
@@ -10,7 +10,6 @@
RawThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
import { communitySubthreads } from '../types/thread-types-enum.js';
-import type { LegacyThreadInfo } from '../types/thread-types.js';
type WritableCommunityDrawerItemData<T> = {
threadInfo: ThreadInfo,
@@ -105,7 +104,7 @@
function filterThreadIDsBelongingToCommunity(
communityID: string,
threadInfosObj: {
- +[id: string]: RawThreadInfo | LegacyThreadInfo | ThreadInfo,
+ +[id: string]: RawThreadInfo | ThreadInfo,
},
): $ReadOnlySet<string> {
const threadInfos = values(threadInfosObj);
diff --git a/lib/utils/message-pinning-utils.js b/lib/utils/message-pinning-utils.js
--- a/lib/utils/message-pinning-utils.js
+++ b/lib/utils/message-pinning-utils.js
@@ -8,18 +8,11 @@
RawThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
-import type {
- LegacyRawThreadInfo,
- LegacyThreadInfo,
-} from '../types/thread-types.js';
+import type { LegacyRawThreadInfo } from '../types/thread-types.js';
function canToggleMessagePin(
messageInfo: RawMessageInfo | MessageInfo,
- threadInfo:
- | LegacyRawThreadInfo
- | RawThreadInfo
- | LegacyThreadInfo
- | ThreadInfo,
+ threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo,
): boolean {
const isValidMessage = !isInvalidPinSourceForThread(messageInfo, threadInfo);
const hasManagePinsPermission = threadHasPermission(
diff --git a/lib/utils/role-utils.js b/lib/utils/role-utils.js
--- a/lib/utils/role-utils.js
+++ b/lib/utils/role-utils.js
@@ -10,11 +10,7 @@
type ThreadRolePermissionsBlob,
type UserSurfacedPermission,
} from '../types/thread-permission-types.js';
-import type {
- LegacyThreadInfo,
- RelativeMemberInfo,
- RoleInfo,
-} from '../types/thread-types';
+import type { RelativeMemberInfo, RoleInfo } from '../types/thread-types';
import { threadTypes } from '../types/thread-types-enum.js';
function constructRoleDeletionMessagePrompt(
@@ -57,7 +53,7 @@
}
function useRolesFromCommunityThreadInfo(
- threadInfo: LegacyThreadInfo | ThreadInfo,
+ threadInfo: ThreadInfo,
memberInfos: $ReadOnlyArray<RelativeMemberInfo>,
): $ReadOnlyMap<string, ?RoleInfo> {
// Our in-code system has chat-specific roles, while the
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 9:18 AM (10 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2702256
Default Alt Text
D10677.diff (19 KB)
Attached To
Mode
D10677: [lib] Remove most remaining instances of `LegacyThreadInfo` from `lib`
Attached
Detach File
Event Timeline
Log In to Comment