Page MenuHomePhabricator

D13423.diff
No OneTemporary

D13423.diff

diff --git a/lib/hooks/flag-hooks.js b/lib/hooks/flag-hooks.js
deleted file mode 100644
--- a/lib/hooks/flag-hooks.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// @flow
-
-import { useIsCurrentUserStaff } from '../shared/staff-utils.js';
-import { isDev } from '../utils/dev-utils.js';
-
-// If this returns true, then DM creation will use E2EE DMs encrypted via Olm
-// and brokered by Tunnelbroker, instead of creating chats under GENESIS on the
-// authoritative keyserver.
-function useAllowOlmViaTunnelbrokerForDMs(): boolean {
- const isCurrentUserStaff = useIsCurrentUserStaff();
- return isDev || isCurrentUserStaff;
-}
-
-export { useAllowOlmViaTunnelbrokerForDMs };
diff --git a/lib/hooks/relationship-hooks.js b/lib/hooks/relationship-hooks.js
--- a/lib/hooks/relationship-hooks.js
+++ b/lib/hooks/relationship-hooks.js
@@ -3,7 +3,6 @@
import * as React from 'react';
import uuid from 'uuid';
-import { useAllowOlmViaTunnelbrokerForDMs } from './flag-hooks.js';
import { useGetAndUpdateDeviceListsForUsers } from './peer-list-hooks.js';
import { useNewThickThread } from './thread-hooks.js';
import { updateRelationships as serverUpdateRelationships } from '../actions/relationship-actions.js';
@@ -276,7 +275,6 @@
updateRelationshipsAndSendRobotext(action, userIDs).then(resolve, reject);
}, [step, auxUserInfos, updateRelationshipsAndSendRobotext]);
- const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
const getAndUpdateDeviceListsForUsers = useGetAndUpdateDeviceListsForUsers();
const coreFunctionality = React.useCallback(
@@ -284,9 +282,8 @@
// We only need to create robotext for FRIEND and FARCASTER_MUTUAL,
// so we skip the complexity below for other RelationshipActions
if (
- !usingOlmViaTunnelbrokerForDMs ||
- (action !== relationshipActions.FRIEND &&
- action !== relationshipActions.FARCASTER_MUTUAL)
+ action !== relationshipActions.FRIEND &&
+ action !== relationshipActions.FARCASTER_MUTUAL
) {
return await updateRelationships({
action,
@@ -356,7 +353,6 @@
updateRelationshipsAndSendRobotext,
updateRelationships,
auxUserInfos,
- usingOlmViaTunnelbrokerForDMs,
],
);
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
@@ -467,8 +467,8 @@
// thread becomes a thin thread, so we're including it twice in a map -
// for each possible pending thread ID.
const possiblePendingThreadTypes = [
- pendingThreadType(actualMemberIDs.length - 1, 'thin', true),
- pendingThreadType(actualMemberIDs.length - 1, 'thick', true),
+ pendingThreadType(actualMemberIDs.length - 1, 'thin'),
+ pendingThreadType(actualMemberIDs.length - 1, 'thick'),
];
for (const type of possiblePendingThreadTypes) {
const pendingThreadID = getPendingThreadID(
diff --git a/lib/shared/thread-actions-utils.js b/lib/shared/thread-actions-utils.js
--- a/lib/shared/thread-actions-utils.js
+++ b/lib/shared/thread-actions-utils.js
@@ -62,7 +62,6 @@
+viewerID: ?string,
+handleError?: () => mixed,
+calendarQuery: CalendarQuery,
- +usingOlmViaTunnelbrokerForDMs: boolean,
+auxUserInfos: AuxUserInfos,
};
@@ -74,7 +73,6 @@
sourceMessageID,
viewerID,
calendarQuery,
- usingOlmViaTunnelbrokerForDMs,
auxUserInfos,
}: CreateRealThreadParameters): Promise<{
+threadID: string,
@@ -142,11 +140,7 @@
);
if (threadTypeIsThick(threadInfo.type) && allUsersSupportThickThreads) {
const type = assertThickThreadType(
- pendingThreadType(
- otherMemberIDs.length,
- 'thick',
- usingOlmViaTunnelbrokerForDMs,
- ),
+ pendingThreadType(otherMemberIDs.length, 'thick'),
);
invariant(
@@ -162,11 +156,7 @@
newThreadType = type;
} else {
const type = assertThinThreadType(
- pendingThreadType(
- otherMemberIDs.length,
- 'thin',
- usingOlmViaTunnelbrokerForDMs,
- ),
+ pendingThreadType(otherMemberIDs.length, 'thin'),
);
invariant(
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
@@ -15,7 +15,6 @@
import ashoat from '../facts/ashoat.js';
import genesis from '../facts/genesis.js';
import { useLoggedInUserInfo } from '../hooks/account-hooks.js';
-import { useAllowOlmViaTunnelbrokerForDMs } from '../hooks/flag-hooks.js';
import { extractKeyserverIDFromIDOptional } from '../keyserver-conn/keyserver-call-utils.js';
import {
hasPermission,
@@ -602,20 +601,15 @@
loggedInUserInfo: LoggedInUserInfo,
userID: string,
username: ?string,
- allowOlmViaTunnelbrokerForDMs: boolean,
): PendingPersonalThread {
const pendingPersonalThreadUserInfo = {
id: userID,
username: username,
};
- const threadType = allowOlmViaTunnelbrokerForDMs
- ? threadTypes.PERSONAL
- : threadTypes.GENESIS_PERSONAL;
-
const threadInfo = createPendingThread({
viewerID: loggedInUserInfo.id,
- threadType,
+ threadType: threadTypes.PERSONAL,
members: [loggedInUserInfo, pendingPersonalThreadUserInfo],
});
@@ -625,15 +619,9 @@
function createPendingThreadItem(
loggedInUserInfo: LoggedInUserInfo,
user: UserIDAndUsername,
- allowOlmViaTunnelbrokerForDMs: boolean,
): ChatThreadItem {
const { threadInfo, pendingPersonalThreadUserInfo } =
- createPendingPersonalThread(
- loggedInUserInfo,
- user.id,
- user.username,
- allowOlmViaTunnelbrokerForDMs,
- );
+ createPendingPersonalThread(loggedInUserInfo, user.id, user.username);
return {
type: 'chatThreadItem',
@@ -702,9 +690,8 @@
function pendingThreadType(
numberOfOtherMembers: number,
thickOrThin: 'thick' | 'thin',
- usingOlmViaTunnelbrokerForDMs: boolean,
): 4 | 6 | 7 | 13 | 14 | 15 {
- if (usingOlmViaTunnelbrokerForDMs && thickOrThin === 'thick') {
+ if (thickOrThin === 'thick') {
if (numberOfOtherMembers === 0) {
return threadTypes.PRIVATE;
} else if (numberOfOtherMembers === 1) {
@@ -1253,7 +1240,6 @@
const pendingToRealizedThreadIDs = useSelector(state =>
pendingToRealizedThreadIDsSelector(state.threadStore.threadInfos),
);
- const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
return React.useCallback(
(params: ExistingThreadInfoFinderParams): ?ThreadInfo => {
if (!baseThreadInfo) {
@@ -1282,11 +1268,7 @@
if (searching) {
const pendingThinThreadID = getPendingThreadID(
- pendingThreadType(
- userInfoInputArray.length,
- 'thin',
- usingOlmViaTunnelbrokerForDMs,
- ),
+ pendingThreadType(userInfoInputArray.length, 'thin'),
[...userInfoInputArray.map(user => user.id), viewerID],
sourceMessageID,
);
@@ -1296,11 +1278,7 @@
return threadInfos[realizedThinThreadID];
}
const pendingThickThreadID = getPendingThreadID(
- pendingThreadType(
- userInfoInputArray.length,
- 'thick',
- usingOlmViaTunnelbrokerForDMs,
- ),
+ pendingThreadType(userInfoInputArray.length, 'thick'),
[...userInfoInputArray.map(user => user.id), viewerID],
sourceMessageID,
);
@@ -1325,24 +1303,14 @@
const updatedThread = searching
? createPendingThread({
viewerID,
- threadType: pendingThreadType(
- userInfoInputArray.length,
- 'thick',
- usingOlmViaTunnelbrokerForDMs,
- ),
+ threadType: pendingThreadType(userInfoInputArray.length, 'thick'),
members: [loggedInUserInfo, ...userInfoInputArray],
})
: baseThreadInfo;
return updatedThread;
},
- [
- baseThreadInfo,
- threadInfos,
- loggedInUserInfo,
- usingOlmViaTunnelbrokerForDMs,
- pendingToRealizedThreadIDs,
- ],
+ [baseThreadInfo, threadInfos, loggedInUserInfo, pendingToRealizedThreadIDs],
);
}
@@ -1440,7 +1408,6 @@
threadSearchResults: $ReadOnlySet<string>,
usersSearchResults: $ReadOnlyArray<GlobalAccountUserInfo>,
loggedInUserInfo: ?LoggedInUserInfo,
- allowOlmViaTunnelbrokerForDMs: boolean,
): $ReadOnlyArray<ChatThreadItem> {
if (!searchText) {
return chatListData.filter(
@@ -1473,11 +1440,7 @@
if (loggedInUserInfo) {
chatItems.push(
...usersSearchResults.map(user =>
- createPendingThreadItem(
- loggedInUserInfo,
- user,
- allowOlmViaTunnelbrokerForDMs,
- ),
+ createPendingThreadItem(loggedInUserInfo, user),
),
);
}
@@ -1710,8 +1673,6 @@
const usersWithPersonalThread = useSelector(usersWithPersonalThreadSelector);
- const allowOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
-
return React.useMemo(() => {
if (!loggedInUserInfo || !userID || !username) {
return null;
@@ -1736,12 +1697,10 @@
loggedInUserInfo,
userID,
username,
- allowOlmViaTunnelbrokerForDMs,
);
return pendingPersonalThreadInfo;
}, [
- allowOlmViaTunnelbrokerForDMs,
isViewerProfile,
loggedInUserInfo,
personalThreadInfos,
diff --git a/native/chat/chat-thread-list.react.js b/native/chat/chat-thread-list.react.js
--- a/native/chat/chat-thread-list.react.js
+++ b/native/chat/chat-thread-list.react.js
@@ -23,7 +23,6 @@
import { useSharedValue } from 'react-native-reanimated';
import { useLoggedInUserInfo } from 'lib/hooks/account-hooks.js';
-import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import { useThreadListSearch } from 'lib/hooks/thread-search-hooks.js';
import {
type ChatThreadItem,
@@ -132,22 +131,17 @@
[],
);
- const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
-
const composeThread = React.useCallback(() => {
if (!loggedInUserInfo) {
return;
}
- const threadType = usingOlmViaTunnelbrokerForDMs
- ? threadTypes.PRIVATE
- : threadTypes.GENESIS_PRIVATE;
const threadInfo = createPendingThread({
viewerID: loggedInUserInfo.id,
- threadType,
+ threadType: threadTypes.PRIVATE,
members: [loggedInUserInfo],
});
navigateToThread({ threadInfo, searching: true });
- }, [loggedInUserInfo, navigateToThread, usingOlmViaTunnelbrokerForDMs]);
+ }, [loggedInUserInfo, navigateToThread]);
const onSearchFocus = React.useCallback(() => {
if (searchStatus !== 'inactive') {
@@ -279,8 +273,6 @@
],
);
- const allowOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
-
const listData: $ReadOnlyArray<Item> = React.useMemo(() => {
const chatThreadItems = getThreadListSearchResults(
boundChatListData,
@@ -289,7 +281,6 @@
threadSearchResults,
usersSearchResults,
loggedInUserInfo,
- allowOlmViaTunnelbrokerForDMs,
);
const chatItems: Item[] = [...chatThreadItems];
@@ -304,7 +295,6 @@
return chatItems;
}, [
- allowOlmViaTunnelbrokerForDMs,
boundChatListData,
emptyItem,
filterThreads,
diff --git a/native/chat/compose-thread-button.react.js b/native/chat/compose-thread-button.react.js
--- a/native/chat/compose-thread-button.react.js
+++ b/native/chat/compose-thread-button.react.js
@@ -4,7 +4,6 @@
import { StyleSheet } from 'react-native';
import { useLoggedInUserInfo } from 'lib/hooks/account-hooks.js';
-import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import { createPendingThread } from 'lib/shared/thread-utils.js';
import { threadTypes } from 'lib/types/thread-types-enum.js';
@@ -20,26 +19,22 @@
function ComposeThreadButton(props: Props) {
const { navigate } = props;
const loggedInUserInfo = useLoggedInUserInfo();
- const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
const onPress = React.useCallback(() => {
if (!loggedInUserInfo) {
return;
}
- const threadType = usingOlmViaTunnelbrokerForDMs
- ? threadTypes.PRIVATE
- : threadTypes.GENESIS_PRIVATE;
navigate<'MessageList'>({
name: MessageListRouteName,
params: {
threadInfo: createPendingThread({
viewerID: loggedInUserInfo.id,
- threadType,
+ threadType: threadTypes.PRIVATE,
members: [loggedInUserInfo],
}),
searching: true,
},
});
- }, [loggedInUserInfo, usingOlmViaTunnelbrokerForDMs, navigate]);
+ }, [loggedInUserInfo, navigate]);
const { listForegroundSecondaryLabel } = useColors();
return (
diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js
--- a/native/chat/message-list-container.react.js
+++ b/native/chat/message-list-container.react.js
@@ -7,7 +7,6 @@
import { Text, View } from 'react-native';
import genesis from 'lib/facts/genesis.js';
-import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import { userInfoSelectorForPotentialMembers } from 'lib/selectors/user-selectors.js';
import {
@@ -96,7 +95,6 @@
// withOverlayContext
+overlayContext: ?OverlayContextType,
+measureMessages: MessagesMeasurer,
- +usingOlmViaTunnelbrokerForDMs: boolean,
};
type State = {
+listDataWithHeights: ?$ReadOnlyArray<ChatMessageItemWithHeight>,
@@ -172,7 +170,6 @@
childThreadType={pendingThreadType(
userInfoInputArray.length,
'thick',
- this.props.usingOlmViaTunnelbrokerForDMs,
)}
/>
);
@@ -183,7 +180,6 @@
childThreadType={pendingThreadType(
userInfoInputArray.length,
'thin',
- this.props.usingOlmViaTunnelbrokerForDMs,
)}
/>
);
@@ -423,8 +419,6 @@
colors.panelBackgroundLabel,
]);
- const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
-
return (
<MessageListContextProvider threadInfo={threadInfo}>
{pinnedCountBanner}
@@ -443,7 +437,6 @@
styles={styles}
overlayContext={overlayContext}
measureMessages={measureMessages}
- usingOlmViaTunnelbrokerForDMs={usingOlmViaTunnelbrokerForDMs}
/>
</MessageListContextProvider>
);
diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js
--- a/native/input/input-state-container.react.js
+++ b/native/input/input-state-container.react.js
@@ -23,7 +23,6 @@
useBlobServiceUpload,
} from 'lib/actions/upload-actions.js';
import commStaffCommunity from 'lib/facts/comm-staff-community.js';
-import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import {
useInputStateContainerSendMultimediaMessage,
useInputStateContainerSendTextMessage,
@@ -171,7 +170,6 @@
) => Promise<NewThreadResult>,
+newThickThread: (request: NewThickThreadRequest) => Promise<string>,
+textMessageCreationSideEffectsFunc: CreationSideEffectsFunc<RawTextMessageInfo>,
- +usingOlmViaTunnelbrokerForDMs: boolean,
+auxUserInfos: AuxUserInfos,
};
type State = {
@@ -576,7 +574,6 @@
sourceMessageID: threadInfo.sourceMessageID,
viewerID: this.props.viewerID,
calendarQuery,
- usingOlmViaTunnelbrokerForDMs: this.props.usingOlmViaTunnelbrokerForDMs,
auxUserInfos: this.props.auxUserInfos,
});
this.pendingThreadCreations.set(threadInfo.id, threadCreationPromise);
@@ -1789,7 +1786,6 @@
const staffCanSee = useStaffCanSee();
const textMessageCreationSideEffectsFunc =
useMessageCreationSideEffectsFunc<RawTextMessageInfo>(messageTypes.TEXT);
- const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
const auxUserInfos = useSelector(state => state.auxUserStore.auxUserInfos);
return (
@@ -1811,7 +1807,6 @@
dispatch={dispatch}
staffCanSee={staffCanSee}
textMessageCreationSideEffectsFunc={textMessageCreationSideEffectsFunc}
- usingOlmViaTunnelbrokerForDMs={usingOlmViaTunnelbrokerForDMs}
auxUserInfos={auxUserInfos}
/>
);
diff --git a/web/chat/thread-list-provider.js b/web/chat/thread-list-provider.js
--- a/web/chat/thread-list-provider.js
+++ b/web/chat/thread-list-provider.js
@@ -4,7 +4,6 @@
import * as React from 'react';
import { useLoggedInUserInfo } from 'lib/hooks/account-hooks.js';
-import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import { useThreadListSearch } from 'lib/hooks/thread-search-hooks.js';
import {
type ChatThreadItem,
@@ -180,7 +179,6 @@
);
const threadFilter =
activeTab === 'Muted' ? threadInBackgroundChatList : threadInHomeChatList;
- const allowOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
const chatListDataWithoutFilter = getThreadListSearchResults(
chatListData,
searchText,
@@ -188,7 +186,6 @@
threadSearchResults,
usersSearchResults,
loggedInUserInfo,
- allowOlmViaTunnelbrokerForDMs,
);
const activeTopLevelChatThreadItem = useChatThreadItem(
activeTopLevelThreadInfo,
diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js
--- a/web/input/input-state-container.react.js
+++ b/web/input/input-state-container.react.js
@@ -33,7 +33,6 @@
} from 'lib/components/modal-provider.react.js';
import blobService from 'lib/facts/blob-service.js';
import commStaffCommunity from 'lib/facts/comm-staff-community.js';
-import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import {
useInputStateContainerSendMultimediaMessage,
useInputStateContainerSendTextMessage,
@@ -171,7 +170,6 @@
+unregisterSendCallback: (() => mixed) => void,
+textMessageCreationSideEffectsFunc: CreationSideEffectsFunc<RawTextMessageInfo>,
+identityContext: ?IdentityClientContextType,
- +usingOlmViaTunnelbrokerForDMs: boolean,
+auxUserInfos: AuxUserInfos,
};
type WritableState = {
@@ -611,7 +609,6 @@
sourceMessageID: threadInfo.sourceMessageID,
viewerID: this.props.viewerID,
calendarQuery,
- usingOlmViaTunnelbrokerForDMs: this.props.usingOlmViaTunnelbrokerForDMs,
auxUserInfos: this.props.auxUserInfos,
});
this.pendingThreadCreations.set(threadInfo.id, threadCreationPromise);
@@ -1734,7 +1731,6 @@
);
const textMessageCreationSideEffectsFunc =
useMessageCreationSideEffectsFunc<RawTextMessageInfo>(messageTypes.TEXT);
- const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
const auxUserInfos = useSelector(state => state.auxUserStore.auxUserInfos);
return (
@@ -1761,7 +1757,6 @@
unregisterSendCallback={unregisterSendCallback}
textMessageCreationSideEffectsFunc={textMessageCreationSideEffectsFunc}
identityContext={identityContext}
- usingOlmViaTunnelbrokerForDMs={usingOlmViaTunnelbrokerForDMs}
auxUserInfos={auxUserInfos}
/>
);
diff --git a/web/utils/thread-utils.js b/web/utils/thread-utils.js
--- a/web/utils/thread-utils.js
+++ b/web/utils/thread-utils.js
@@ -4,7 +4,6 @@
import * as React from 'react';
import { useLoggedInUserInfo } from 'lib/hooks/account-hooks.js';
-import { useAllowOlmViaTunnelbrokerForDMs } from 'lib/hooks/flag-hooks.js';
import { threadInfoSelector } from 'lib/selectors/thread-selectors.js';
import { userInfoSelectorForPotentialMembers } from 'lib/selectors/user-selectors.js';
import {
@@ -54,24 +53,18 @@
}),
);
- const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs();
-
- const threadType = usingOlmViaTunnelbrokerForDMs
- ? threadTypes.PRIVATE
- : threadTypes.GENESIS_PRIVATE;
-
const newThreadID = 'pending/new_thread';
const pendingNewThread = React.useMemo(
() => ({
...createPendingThread({
viewerID: loggedInUserInfo.id,
- threadType,
+ threadType: threadTypes.PRIVATE,
members: [loggedInUserInfo],
name: 'New thread',
}),
id: newThreadID,
}),
- [loggedInUserInfo, threadType],
+ [loggedInUserInfo],
);
const existingThreadInfoFinderForCreatingThread = useExistingThreadInfoFinder(
pendingPrivateThread.current,

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 28, 7:16 PM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2197735
Default Alt Text
D13423.diff (20 KB)

Event Timeline