Page MenuHomePhabricator

D9890.diff
No OneTemporary

D9890.diff

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
@@ -5,6 +5,7 @@
import genesis from '../facts/genesis.js';
import { threadInfoSelector } from '../selectors/thread-selectors.js';
import SentencePrefixSearchIndex from '../shared/sentence-prefix-search-index.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { threadTypes } from '../types/thread-types-enum.js';
import type {
ChatMentionCandidates,
@@ -20,7 +21,7 @@
};
export type ChatMentionContextType = {
+getChatMentionSearchIndex: (
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
) => SentencePrefixSearchIndex,
+communityThreadIDForGenesisThreads: { +[id: string]: string },
+chatMentionCandidatesObj: ChatMentionCandidatesObj,
@@ -42,7 +43,7 @@
const searchIndices = useChatMentionSearchIndex(chatMentionCandidatesObj);
const getChatMentionSearchIndex = React.useCallback(
- (threadInfo: ThreadInfo) => {
+ (threadInfo: ThreadInfo | MinimallyEncodedThreadInfo) => {
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
@@ -8,6 +8,7 @@
type ChatMentionContextType,
} from '../components/chat-mention-provider.react.js';
import genesis from '../facts/genesis.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import type {
ChatMentionCandidates,
ThreadInfo,
@@ -21,7 +22,7 @@
}
function useThreadChatMentionCandidates(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
): 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
@@ -14,12 +14,13 @@
import { childThreadInfos } from '../selectors/thread-selectors.js';
import { threadInChatList } from '../shared/thread-utils.js';
import threadWatcher from '../shared/thread-watcher.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import type { ThreadInfo } from '../types/thread-types.js';
import { useDispatchActionPromise } from '../utils/action-utils.js';
import { useSelector } from '../utils/redux-utils.js';
type ThreadFilter = {
- +predicate?: (thread: ThreadInfo) => boolean,
+ +predicate?: (thread: ThreadInfo | MinimallyEncodedThreadInfo) => boolean,
+searchText?: string,
};
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
@@ -13,6 +13,7 @@
threadIsSidebar,
} from '../shared/thread-utils.js';
import type { LoadingStatus } from '../types/loading-types.js';
+import type { MinimallyEncodedThreadInfo } 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 ThreadInfo } from '../types/thread-types.js';
@@ -20,8 +21,8 @@
import { useSelector } from '../utils/redux-utils.js';
function canPromoteSidebar(
- sidebarThreadInfo: ThreadInfo,
- parentThreadInfo: ?ThreadInfo,
+ sidebarThreadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
+ parentThreadInfo: ?ThreadInfo | ?MinimallyEncodedThreadInfo,
): boolean {
if (!threadIsSidebar(sidebarThreadInfo)) {
return false;
@@ -45,7 +46,7 @@
};
function usePromoteSidebar(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
onError?: () => mixed,
): PromoteSidebarType {
const dispatchActionPromise = useDispatchActionPromise();
@@ -56,9 +57,10 @@
const loadingStatus = useSelector(loadingStatusSelector);
const { parentThreadID } = threadInfo;
- const parentThreadInfo: ?ThreadInfo = useSelector(state =>
- parentThreadID ? threadInfoSelector(state)[parentThreadID] : null,
- );
+ const parentThreadInfo: ?ThreadInfo | ?MinimallyEncodedThreadInfo =
+ 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
@@ -9,6 +9,7 @@
updateRelationshipsActionTypes,
} from '../actions/relationship-actions.js';
import { getSingleOtherUser } from '../shared/thread-utils.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import {
type RelationshipAction,
relationshipActions,
@@ -33,7 +34,7 @@
};
function useRelationshipPrompt(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
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
@@ -10,6 +10,10 @@
import { sidebarInfoSelector } from '../selectors/thread-selectors.js';
import { threadIsChannel } from '../shared/thread-utils.js';
import type { SetState } from '../types/hook-types.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import type {
SidebarInfo,
ThreadInfo,
@@ -31,7 +35,7 @@
};
function useSearchThreads<U: SidebarInfo | ChatThreadItem>(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
childThreadInfos: $ReadOnlyArray<U>,
): SearchThreadsResult<U> {
const [searchState, setSearchState] = React.useState({
@@ -91,7 +95,7 @@
}
function useSearchSidebars(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
): SearchThreadsResult<SidebarInfo> {
const childThreadInfos = useSelector(
state => sidebarInfoSelector(state)[threadInfo.id] ?? [],
@@ -100,11 +104,17 @@
}
function useSearchSubchannels(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
): SearchThreadsResult<ChatThreadItem> {
const filterFunc = React.useCallback(
- (thread: ?(ThreadInfo | RawThreadInfo)) =>
- threadIsChannel(thread) && thread?.parentThreadID === threadInfo.id,
+ (
+ thread: ?(
+ | ThreadInfo
+ | RawThreadInfo
+ | MinimallyEncodedThreadInfo
+ | MinimallyEncodedRawThreadInfo
+ ),
+ ) => threadIsChannel(thread) && thread?.parentThreadID === threadInfo.id,
[threadInfo.id],
);
const childThreadInfos = useFilteredChatListData(filterFunc);
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
@@ -10,11 +10,12 @@
SetThreadUnreadStatusPayload,
SetThreadUnreadStatusRequest,
} from '../types/activity-types.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import type { ThreadInfo } from '../types/thread-types.js';
import { useDispatchActionPromise } from '../utils/action-utils.js';
function useToggleUnreadStatus(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
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
@@ -36,6 +36,10 @@
type LocalMessageInfo,
isComposableMessageType,
} from '../types/message-types.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import type { BaseAppState } from '../types/redux-types.js';
import { threadTypes } from '../types/thread-types-enum.js';
import {
@@ -95,7 +99,7 @@
}
function getMostRecentMessageInfo(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
messageStore: MessageStore,
messages: { +[id: string]: ?MessageInfo },
): ?MessageInfo {
@@ -114,7 +118,7 @@
}
function getLastUpdatedTime(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
mostRecentMessageInfo: ?MessageInfo,
): number {
return mostRecentMessageInfo
@@ -227,7 +231,14 @@
}
function useFilteredChatListData(
- filterFunction: (threadInfo: ?(ThreadInfo | RawThreadInfo)) => boolean,
+ filterFunction: (
+ threadInfo: ?(
+ | ThreadInfo
+ | RawThreadInfo
+ | MinimallyEncodedThreadInfo
+ | MinimallyEncodedRawThreadInfo
+ ),
+ ) => boolean,
): $ReadOnlyArray<ChatThreadItem> {
const threadInfos = useSelector(threadInfoSelector);
const messageInfos = useSelector(messageInfoSelector);
@@ -252,7 +263,14 @@
messageStore: MessageStore,
messageInfos: { +[id: string]: ?MessageInfo },
sidebarInfos: { +[id: string]: $ReadOnlyArray<SidebarInfo> },
- filterFunction: (threadInfo: ?(ThreadInfo | RawThreadInfo)) => boolean,
+ filterFunction: (
+ threadInfo: ?(
+ | ThreadInfo
+ | RawThreadInfo
+ | MinimallyEncodedThreadInfo
+ | MinimallyEncodedRawThreadInfo
+ ),
+ ) => boolean,
): $ReadOnlyArray<ChatThreadItem> {
return _flow(
_filter(filterFunction),
@@ -607,7 +625,7 @@
export type UseMessageListDataArgs = {
+searching: boolean,
+userInfoInputArray: $ReadOnlyArray<AccountUserInfo>,
- +threadInfo: ?ThreadInfo,
+ +threadInfo: ?ThreadInfo | ?MinimallyEncodedThreadInfo,
};
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
@@ -12,6 +12,10 @@
defaultCalendarQuery,
} from '../types/entry-types.js';
import type { CalendarFilter } from '../types/filter-types.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} 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 { RawThreadInfo, ThreadInfo } from '../types/thread-types.js';
@@ -78,7 +82,12 @@
const useENSNamesOptions = { allAtOnce: true };
function useThreadSearchIndex(
- threadInfos: $ReadOnlyArray<RawThreadInfo | ThreadInfo>,
+ threadInfos: $ReadOnlyArray<
+ | RawThreadInfo
+ | ThreadInfo
+ | MinimallyEncodedRawThreadInfo
+ | MinimallyEncodedThreadInfo,
+ >,
): SearchIndex {
const userInfos = useSelector(state => state.userStore.userInfos);
const viewerID = useSelector(
diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js
--- a/lib/selectors/thread-selectors.js
+++ b/lib/selectors/thread-selectors.js
@@ -39,6 +39,7 @@
import type { ClientEmojiAvatar } from '../types/avatar-types';
import type { EntryInfo } from '../types/entry-types.js';
import type { MessageStore, RawMessageInfo } from '../types/message-types.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import type { BaseAppState } from '../types/redux-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
import {
@@ -225,7 +226,7 @@
);
function getMostRecentRawMessageInfo(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
messageStore: MessageStore,
): ?RawMessageInfo {
const thread = messageStore.threads[threadInfo.id];
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
@@ -6,11 +6,12 @@
ancestorThreadInfos,
} from '../selectors/thread-selectors.js';
import { threadIsPending } from '../shared/thread-utils.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { type ThreadInfo } from '../types/thread-types.js';
import { useSelector } from '../utils/redux-utils.js';
function useAncestorThreads(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
): $ReadOnlyArray<ThreadInfo> {
return useSelector(state => {
if (!threadIsPending(threadInfo.id)) {
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
@@ -16,6 +16,10 @@
ResolvedClientAvatar,
GenericUserInfoWithAvatar,
} from '../types/avatar-types.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import { threadTypes } from '../types/thread-types-enum.js';
import { type RawThreadInfo, type ThreadInfo } from '../types/thread-types.js';
import type { UserInfos } from '../types/user-types.js';
@@ -270,7 +274,11 @@
}
function getUserAvatarForThread(
- threadInfo: RawThreadInfo | ThreadInfo,
+ threadInfo:
+ | RawThreadInfo
+ | ThreadInfo
+ | MinimallyEncodedRawThreadInfo
+ | MinimallyEncodedThreadInfo,
viewerID: ?string,
userInfos: UserInfos,
): ClientAvatar {
@@ -296,8 +304,12 @@
}
function getAvatarForThread(
- thread: RawThreadInfo | ThreadInfo,
- containingThreadInfo: ?ThreadInfo,
+ thread:
+ | RawThreadInfo
+ | ThreadInfo
+ | MinimallyEncodedThreadInfo
+ | MinimallyEncodedRawThreadInfo,
+ containingThreadInfo: ?ThreadInfo | ?MinimallyEncodedThreadInfo,
): ClientAvatar {
if (thread.avatar) {
return thread.avatar;
@@ -312,7 +324,13 @@
return getDefaultAvatar(thread.id, thread.color);
}
-function useAvatarForThread(thread: RawThreadInfo | ThreadInfo): ClientAvatar {
+function useAvatarForThread(
+ thread:
+ | RawThreadInfo
+ | ThreadInfo
+ | MinimallyEncodedRawThreadInfo
+ | MinimallyEncodedThreadInfo,
+): 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
@@ -14,6 +14,7 @@
RawMessageInfo,
} from '../types/message-types';
import { messageTypes } from '../types/message-types-enum.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
import { type ThreadInfo } from '../types/thread-types.js';
import { useDispatchActionPromise } from '../utils/action-utils.js';
@@ -48,7 +49,7 @@
}
function useCanEditMessage(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
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
@@ -1,9 +1,12 @@
// @flow
import type { ReactionInfo } from '../selectors/chat-selectors.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import type { ThreadInfo } from '../types/thread-types.js';
-function getInlineEngagementSidebarText(threadInfo: ?ThreadInfo): string {
+function getInlineEngagementSidebarText(
+ threadInfo: ?ThreadInfo | ?MinimallyEncodedThreadInfo,
+): string {
if (!threadInfo) {
return '';
}
diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js
--- a/lib/shared/message-utils.js
+++ b/lib/shared/message-utils.js
@@ -41,6 +41,10 @@
RawReactionMessageInfo,
ReactionMessageInfo,
} from '../types/messages/reaction.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import type { RawThreadInfo, ThreadInfo } from '../types/thread-types.js';
import type { UserInfos } from '../types/user-types.js';
import {
@@ -678,7 +682,11 @@
function isInvalidPinSourceForThread(
messageInfo: RawMessageInfo | MessageInfo,
- threadInfo: RawThreadInfo | ThreadInfo,
+ threadInfo:
+ | RawThreadInfo
+ | ThreadInfo
+ | MinimallyEncodedRawThreadInfo
+ | MinimallyEncodedThreadInfo,
): boolean {
const isValidPinSource = !isInvalidPinSource(messageInfo);
const isFirstMessageInSidebar = threadInfo.sourceMessageID === messageInfo.id;
diff --git a/lib/shared/notif-utils.js b/lib/shared/notif-utils.js
--- a/lib/shared/notif-utils.js
+++ b/lib/shared/notif-utils.js
@@ -17,6 +17,7 @@
} from '../types/message-types.js';
import type { CreateSidebarMessageInfo } from '../types/messages/create-sidebar.js';
import type { TextMessageInfo } from '../types/messages/text.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import type { NotifTexts, ResolvedNotifTexts } from '../types/notif-types.js';
import { type ThreadType, threadTypes } from '../types/thread-types-enum.js';
import { type ThreadInfo } from '../types/thread-types.js';
@@ -108,7 +109,7 @@
type NotifTextsForSubthreadCreationInput = {
+creator: RelativeUserInfo,
+threadType: ThreadType,
- +parentThreadInfo: ThreadInfo,
+ +parentThreadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
+childThreadName: ?string,
+childThreadUIName: string | ThreadEntity,
};
@@ -147,7 +148,7 @@
+createSidebarMessageInfo: CreateSidebarMessageInfo,
+sidebarSourceMessageInfo?: ?SidebarSourceMessageInfo,
+firstSidebarMessageInfo?: ?TextMessageInfo,
- +threadInfo: ThreadInfo,
+ +threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
+params: NotificationTextsParams,
};
function notifTextsForSidebarCreation(
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
@@ -12,6 +12,7 @@
RobotextMessageInfo,
ComposableMessageInfo,
} from '../types/message-types.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
import { type ThreadInfo } from '../types/thread-types.js';
import { useSelector } from '../utils/redux-utils.js';
@@ -74,7 +75,7 @@
}
function useCanCreateReactionFromMessage(
- threadInfo: ThreadInfo,
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
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
@@ -24,6 +24,7 @@
} from '../selectors/chat-selectors';
import type { MessageInfo, RawMessageInfo } from '../types/message-types';
import { isComposableMessageType } from '../types/message-types.js';
+import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
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';
@@ -56,8 +57,8 @@
+searchIndex: SearchIndex,
+excludeUserIDs: $ReadOnlyArray<string>,
+includeServerSearchUsers?: $ReadOnlyArray<GlobalAccountUserInfo>,
- +inputParentThreadInfo?: ?ThreadInfo,
- +inputCommunityThreadInfo?: ?ThreadInfo,
+ +inputParentThreadInfo?: ?ThreadInfo | ?MinimallyEncodedThreadInfo,
+ +inputCommunityThreadInfo?: ?ThreadInfo | ?MinimallyEncodedThreadInfo,
+threadType?: ?ThreadType,
}): UserListItem[] {
const communityThreadInfo =
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
@@ -762,7 +762,7 @@
}
type CreateRealThreadParameters = {
- +threadInfo: ThreadInfo,
+ +threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
+dispatchActionPromise: DispatchActionPromise,
+createNewThread: ClientNewThreadRequest => Promise<NewThreadResult>,
+sourceMessageID: ?string,
@@ -1286,7 +1286,7 @@
}
}
-function useWatchThread(threadInfo: ?ThreadInfo) {
+function useWatchThread(threadInfo: ?ThreadInfo | ?MinimallyEncodedThreadInfo) {
const dispatchActionPromise = useDispatchActionPromise();
const callFetchMostRecentMessages = useFetchMostRecentMessages();
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
@@ -2,6 +2,10 @@
import { memberHasAdminPowers } from './thread-utils.js';
import { useENSNames } from '../hooks/ens-cache.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import type {
RawThreadInfo,
ServerThreadInfo,
@@ -33,7 +37,12 @@
}
function useKeyserverAdmin(
- community: ThreadInfo | RawThreadInfo | ServerThreadInfo,
+ community:
+ | ThreadInfo
+ | RawThreadInfo
+ | ServerThreadInfo
+ | MinimallyEncodedThreadInfo
+ | MinimallyEncodedRawThreadInfo,
): ?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
@@ -2,6 +2,10 @@
import { values } from './objects.js';
import { threadInFilterList, threadIsChannel } from '../shared/thread-utils.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import { communitySubthreads } from '../types/thread-types-enum.js';
import type {
RawThreadInfo,
@@ -54,8 +58,12 @@
}
function threadHasSubchannels(
- threadInfo: ThreadInfo,
- childThreadInfosMap: { +[id: string]: $ReadOnlyArray<ThreadInfo> },
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
+ childThreadInfosMap: {
+ +[id: string]:
+ | $ReadOnlyArray<ThreadInfo>
+ | $ReadOnlyArray<MinimallyEncodedThreadInfo>,
+ },
): boolean {
if (!childThreadInfosMap[threadInfo.id]?.length) {
return false;
@@ -85,7 +93,13 @@
function filterThreadIDsBelongingToCommunity(
communityID: string,
- threadInfosObj: { +[id: string]: ThreadInfo | RawThreadInfo },
+ threadInfosObj: {
+ +[id: string]:
+ | ThreadInfo
+ | RawThreadInfo
+ | MinimallyEncodedThreadInfo
+ | MinimallyEncodedRawThreadInfo,
+ },
): $ReadOnlySet<string> {
const threadInfos = values(threadInfosObj);
const threadIDs = threadInfos
diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js
--- a/lib/utils/entity-text.js
+++ b/lib/utils/entity-text.js
@@ -9,6 +9,10 @@
import { useENSNames, type UseENSNamesOptions } from '../hooks/ens-cache.js';
import { threadNoun } from '../shared/thread-utils.js';
import { stringForUser } from '../shared/user-utils.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import {
type ThreadType,
threadTypes,
@@ -134,17 +138,25 @@
type EntityTextThreadInput =
| {
+display: 'uiName',
- +threadInfo: ThreadInfo,
+ +threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
}
| {
+display?: 'shortName',
- +threadInfo: ThreadInfo | RawThreadInfo,
+ +threadInfo:
+ | ThreadInfo
+ | RawThreadInfo
+ | MinimallyEncodedThreadInfo
+ | MinimallyEncodedRawThreadInfo,
+subchannel?: ?boolean,
+possessive?: ?boolean,
}
| {
+display: 'alwaysDisplayShortName',
- +threadInfo: ThreadInfo | RawThreadInfo,
+ +threadInfo:
+ | ThreadInfo
+ | RawThreadInfo
+ | MinimallyEncodedThreadInfo
+ | MinimallyEncodedRawThreadInfo,
+possessive?: ?boolean,
}
| {
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
@@ -4,6 +4,11 @@
import { useSelector } from './redux-utils.js';
import { threadInfoSelector } from '../selectors/thread-selectors.js';
+import type {
+ MinimallyEncodedRelativeMemberInfo,
+ MinimallyEncodedRoleInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import {
type UserSurfacedPermissionOption,
userSurfacedPermissions,
@@ -81,9 +86,11 @@
}
function useRolesFromCommunityThreadInfo(
- threadInfo: ThreadInfo,
- memberInfos: $ReadOnlyArray<RelativeMemberInfo>,
-): $ReadOnlyMap<string, ?RoleInfo> {
+ threadInfo: ThreadInfo | MinimallyEncodedThreadInfo,
+ memberInfos: $ReadOnlyArray<
+ RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo,
+ >,
+): $ReadOnlyMap<string, ?RoleInfo | ?MinimallyEncodedRoleInfo> {
// Our in-code system has chat-specific roles, while the
// user-surfaced system has roles only for communities. We retrieve roles
// from the top-level community thread for accuracy, with a rare fallback
diff --git a/lib/utils/toggle-pin-utils.js b/lib/utils/toggle-pin-utils.js
--- a/lib/utils/toggle-pin-utils.js
+++ b/lib/utils/toggle-pin-utils.js
@@ -3,12 +3,20 @@
import { isInvalidPinSourceForThread } from '../shared/message-utils.js';
import { threadHasPermission } from '../shared/thread-utils.js';
import type { RawMessageInfo, MessageInfo } from '../types/message-types.js';
+import type {
+ MinimallyEncodedRawThreadInfo,
+ MinimallyEncodedThreadInfo,
+} from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
import type { RawThreadInfo, ThreadInfo } from '../types/thread-types.js';
function canToggleMessagePin(
messageInfo: RawMessageInfo | MessageInfo,
- threadInfo: RawThreadInfo | ThreadInfo,
+ threadInfo:
+ | RawThreadInfo
+ | ThreadInfo
+ | MinimallyEncodedRawThreadInfo
+ | MinimallyEncodedThreadInfo,
): boolean {
const isValidMessage = !isInvalidPinSourceForThread(messageInfo, threadInfo);
const hasManagePinsPermission = threadHasPermission(

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 7, 12:16 PM (21 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2254392
Default Alt Text
D9890.diff (26 KB)

Event Timeline