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 { useNewThickThread } from './thread-hooks.js'; import { useFindUserIdentities } from '../actions/find-user-identities-actions.js'; import { updateRelationships as serverUpdateRelationships } from '../actions/relationship-actions.js'; @@ -231,14 +230,11 @@ const [inProgress, setInProgress] = React.useState(false); - const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs(); - const coreFunctionality = React.useCallback( async (action: RelationshipAction, userIDs: $ReadOnlyArray) => { if ( - usingOlmViaTunnelbrokerForDMs && - (action === relationshipActions.FRIEND || - action === relationshipActions.FARCASTER_MUTUAL) + action === relationshipActions.FRIEND || + action === relationshipActions.FARCASTER_MUTUAL ) { // We only need to create robotext for FRIEND and FARCASTER_MUTUAL, so // we skip the complexity of updateRelationshipsAndSendRobotext for @@ -263,11 +259,7 @@ } return await updateRelationships(request); }, - [ - updateRelationshipsAndSendRobotext, - updateRelationships, - usingOlmViaTunnelbrokerForDMs, - ], + [updateRelationshipsAndSendRobotext, updateRelationships], ); return React.useCallback( diff --git a/lib/hooks/user-identities-hooks.js b/lib/hooks/user-identities-hooks.js --- a/lib/hooks/user-identities-hooks.js +++ b/lib/hooks/user-identities-hooks.js @@ -2,7 +2,6 @@ import * as React from 'react'; -import { useAllowOlmViaTunnelbrokerForDMs } from './flag-hooks.js'; import { useFindUserIdentities } from '../actions/find-user-identities-actions.js'; import { userHasDeviceList } from '../shared/thread-utils.js'; import { useSelector } from '../utils/redux-utils.js'; @@ -12,16 +11,11 @@ ) => Promise<$ReadOnlySet> { const findUserIdentities = useFindUserIdentities(); const auxUserInfos = useSelector(state => state.auxUserStore.auxUserInfos); - const allowOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs(); return React.useCallback( async (userIDs: $ReadOnlyArray) => { const usersSupportingThickThreads = new Set(); - if (!allowOlmViaTunnelbrokerForDMs) { - return usersSupportingThickThreads; - } - const usersNeedingFetch = []; for (const userID of userIDs) { if (userHasDeviceList(userID, auxUserInfos)) { @@ -40,7 +34,7 @@ } return usersSupportingThickThreads; }, - [allowOlmViaTunnelbrokerForDMs, auxUserInfos, findUserIdentities], + [auxUserInfos, findUserIdentities], ); } 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 @@ -60,7 +60,6 @@ +viewerID: ?string, +handleError?: () => mixed, +calendarQuery: CalendarQuery, - +usingOlmViaTunnelbrokerForDMs: boolean, }; async function createRealThreadFromPendingThread({ @@ -71,7 +70,6 @@ sourceMessageID, viewerID, calendarQuery, - usingOlmViaTunnelbrokerForDMs, }: CreateRealThreadParameters): Promise<{ +threadID: string, +threadType: ThreadType, @@ -135,11 +133,7 @@ ); if (threadTypeIsThick(threadInfo.type)) { const type = assertThickThreadType( - pendingThreadType( - otherMemberIDs.length, - 'thick', - usingOlmViaTunnelbrokerForDMs, - ), + pendingThreadType(otherMemberIDs.length, 'thick'), ); invariant( @@ -155,11 +149,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 { type UserSearchResult } from '../hooks/thread-search-hooks.js'; import { useUsersSupportThickThreads } from '../hooks/user-identities-hooks.js'; import { extractKeyserverIDFromIDOptional } from '../keyserver-conn/keyserver-call-utils.js'; @@ -705,9 +704,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) { @@ -1257,7 +1255,6 @@ const pendingToRealizedThreadIDs = useSelector(state => pendingToRealizedThreadIDsSelector(state.threadStore.threadInfos), ); - const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs(); return React.useCallback( (params: ExistingThreadInfoFinderParams): ?ThreadInfo => { if (!baseThreadInfo) { @@ -1286,11 +1283,7 @@ if (searching) { const pendingThinThreadID = getPendingThreadID( - pendingThreadType( - userInfoInputArray.length, - 'thin', - usingOlmViaTunnelbrokerForDMs, - ), + pendingThreadType(userInfoInputArray.length, 'thin'), [...userInfoInputArray.map(user => user.id), viewerID], sourceMessageID, ); @@ -1300,11 +1293,7 @@ return threadInfos[realizedThinThreadID]; } const pendingThickThreadID = getPendingThreadID( - pendingThreadType( - userInfoInputArray.length, - 'thick', - usingOlmViaTunnelbrokerForDMs, - ), + pendingThreadType(userInfoInputArray.length, 'thick'), [...userInfoInputArray.map(user => user.id), viewerID], sourceMessageID, ); @@ -1332,7 +1321,6 @@ threadType: pendingThreadType( userInfoInputArray.length, params.allUsersSupportThickThreads ? 'thick' : 'thin', - usingOlmViaTunnelbrokerForDMs, ), members: [loggedInUserInfo, ...userInfoInputArray], }) @@ -1340,13 +1328,7 @@ return updatedThread; }, - [ - baseThreadInfo, - threadInfos, - loggedInUserInfo, - usingOlmViaTunnelbrokerForDMs, - pendingToRealizedThreadIDs, - ], + [baseThreadInfo, threadInfos, loggedInUserInfo, pendingToRealizedThreadIDs], ); } 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') { 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 { useUsersSupportThickThreads } from 'lib/hooks/user-identities-hooks.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { userInfoSelectorForPotentialMembers } from 'lib/selectors/user-selectors.js'; @@ -97,7 +96,6 @@ // withOverlayContext +overlayContext: ?OverlayContextType, +measureMessages: MessagesMeasurer, - +usingOlmViaTunnelbrokerForDMs: boolean, }; type State = { +listDataWithHeights: ?$ReadOnlyArray, @@ -173,7 +171,6 @@ childThreadType={pendingThreadType( userInfoInputArray.length, 'thick', - this.props.usingOlmViaTunnelbrokerForDMs, )} /> ); @@ -184,7 +181,6 @@ childThreadType={pendingThreadType( userInfoInputArray.length, 'thin', - this.props.usingOlmViaTunnelbrokerForDMs, )} /> ); @@ -455,8 +451,6 @@ colors.panelBackgroundLabel, ]); - const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs(); - return ( {pinnedCountBanner} @@ -475,7 +469,6 @@ styles={styles} overlayContext={overlayContext} measureMessages={measureMessages} - usingOlmViaTunnelbrokerForDMs={usingOlmViaTunnelbrokerForDMs} /> ); 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, @@ -170,7 +169,6 @@ ) => Promise, +newThickThread: (request: NewThickThreadRequest) => Promise, +textMessageCreationSideEffectsFunc: CreationSideEffectsFunc, - +usingOlmViaTunnelbrokerForDMs: boolean, }; type State = { +pendingUploads: PendingMultimediaUploads, @@ -574,7 +572,6 @@ sourceMessageID: threadInfo.sourceMessageID, viewerID: this.props.viewerID, calendarQuery, - usingOlmViaTunnelbrokerForDMs: this.props.usingOlmViaTunnelbrokerForDMs, }); this.pendingThreadCreations.set(threadInfo.id, threadCreationPromise); } @@ -1786,7 +1783,6 @@ const staffCanSee = useStaffCanSee(); const textMessageCreationSideEffectsFunc = useMessageCreationSideEffectsFunc(messageTypes.TEXT); - const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs(); return ( ); }); 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, @@ -170,7 +169,6 @@ +unregisterSendCallback: (() => mixed) => void, +textMessageCreationSideEffectsFunc: CreationSideEffectsFunc, +identityContext: ?IdentityClientContextType, - +usingOlmViaTunnelbrokerForDMs: boolean, }; type WritableState = { pendingUploads: { @@ -609,7 +607,6 @@ sourceMessageID: threadInfo.sourceMessageID, viewerID: this.props.viewerID, calendarQuery, - usingOlmViaTunnelbrokerForDMs: this.props.usingOlmViaTunnelbrokerForDMs, }); this.pendingThreadCreations.set(threadInfo.id, threadCreationPromise); } @@ -1731,7 +1728,6 @@ ); const textMessageCreationSideEffectsFunc = useMessageCreationSideEffectsFunc(messageTypes.TEXT); - const usingOlmViaTunnelbrokerForDMs = useAllowOlmViaTunnelbrokerForDMs(); return ( ); }); 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 { useUsersSupportThickThreads } from 'lib/hooks/user-identities-hooks.js'; import { threadInfoSelector } from 'lib/selectors/thread-selectors.js'; import { userInfoSelectorForPotentialMembers } from 'lib/selectors/user-selectors.js'; @@ -55,24 +54,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,