diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 32da4f1963..9a4711eec4 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2393,20 +2393,6 @@ } } }, - "chooseGroupMembers__cant-add-member__title": { - "message": "Can’t add member", - "description": "Shown in the alert when you try to add someone who can't be added to a group" - }, - "chooseGroupMembers__cant-add-member__body": { - "message": "\"$name$\" can’t be added to the group because they’re using an old version of Signal. You can add them to the group after they’ve updated Signal.", - "description": "Shown in the alert when you try to add someone who can't be added to a group", - "placeholders": { - "max": { - "content": "$1", - "example": "Jane Doe" - } - } - }, "setGroupMetadata__title": { "message": "Name this group", "description": "The title for the 'set group metadata' left pane screen" diff --git a/ts/components/AddGroupMemberErrorDialog.stories.tsx b/ts/components/AddGroupMemberErrorDialog.stories.tsx index fde85eed77..423185eeb4 100644 --- a/ts/components/AddGroupMemberErrorDialog.stories.tsx +++ b/ts/components/AddGroupMemberErrorDialog.stories.tsx @@ -1,4 +1,4 @@ -// Copyright 2021 Signal Messenger, LLC +// Copyright 2021-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; @@ -22,14 +22,6 @@ const defaultProps = { onClose: action('onClose'), }; -story.add("Can't add a contact", () => ( - -)); - story.add('Maximum group size', () => ( = let title: string; let body: ReactNode; switch (props.mode) { - case AddGroupMemberErrorDialogMode.CantAddContact: { - const { contact } = props; - title = i18n('chooseGroupMembers__cant-add-member__title'); - body = ( - ]} - /> - ); - break; - } case AddGroupMemberErrorDialogMode.MaximumGroupSize: { const { maximumNumberOfContacts } = props; title = i18n('chooseGroupMembers__maximum-group-size__title'); diff --git a/ts/components/ConversationList.stories.tsx b/ts/components/ConversationList.stories.tsx index 4fa011fd97..3687b64508 100644 --- a/ts/components/ConversationList.stories.tsx +++ b/ts/components/ConversationList.stories.tsx @@ -1,4 +1,4 @@ -// Copyright 2021 Signal Messenger, LLC +// Copyright 2021-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useContext } from 'react'; @@ -195,12 +195,6 @@ story.add('Contact checkboxes: disabled', () => ( isChecked: false, disabledReason: ContactCheckboxDisabledReason.MaximumContactsSelected, }, - { - type: RowType.ContactCheckbox, - contact: defaultConversations[1], - isChecked: false, - disabledReason: ContactCheckboxDisabledReason.NotCapable, - }, { type: RowType.ContactCheckbox, contact: defaultConversations[2], diff --git a/ts/components/LeftPane.stories.tsx b/ts/components/LeftPane.stories.tsx index cb90aebb5c..bea95ce463 100644 --- a/ts/components/LeftPane.stories.tsx +++ b/ts/components/LeftPane.stories.tsx @@ -90,11 +90,9 @@ const defaultModeSpecificProps = { const emptySearchResultsGroup = { isLoading: false, results: [] }; const useProps = (overrideProps: Partial = {}): PropsType => ({ - cantAddContactToGroup: action('cantAddContactToGroup'), clearConversationSearch: action('clearConversationSearch'), clearGroupCreationError: action('clearGroupCreationError'), clearSearch: action('clearSearch'), - closeCantAddContactToGroupModal: action('closeCantAddContactToGroupModal'), closeMaximumGroupSizeModal: action('closeMaximumGroupSizeModal'), closeRecommendedGroupSizeModal: action('closeRecommendedGroupSizeModal'), composeDeleteAvatarFromDisk: action('composeDeleteAvatarFromDisk'), diff --git a/ts/components/LeftPane.tsx b/ts/components/LeftPane.tsx index 01bae2d48b..419ade8245 100644 --- a/ts/components/LeftPane.tsx +++ b/ts/components/LeftPane.tsx @@ -95,11 +95,9 @@ export type PropsType = { theme: ThemeType; // Action Creators - cantAddContactToGroup: (conversationId: string) => void; clearConversationSearch: () => void; clearGroupCreationError: () => void; clearSearch: () => void; - closeCantAddContactToGroupModal: () => void; closeMaximumGroupSizeModal: () => void; closeRecommendedGroupSizeModal: () => void; createGroup: () => void; @@ -149,13 +147,11 @@ export type PropsType = { }; export const LeftPane: React.FC = ({ - cantAddContactToGroup, challengeStatus, crashReportCount, clearConversationSearch, clearGroupCreationError, clearSearch, - closeCantAddContactToGroupModal, closeMaximumGroupSizeModal, closeRecommendedGroupSizeModal, composeDeleteAvatarFromDisk, @@ -466,7 +462,6 @@ export const LeftPane: React.FC = ({ clearConversationSearch, clearGroupCreationError, clearSearch, - closeCantAddContactToGroupModal, closeMaximumGroupSizeModal, closeRecommendedGroupSizeModal, composeDeleteAvatarFromDisk, @@ -607,9 +602,6 @@ export const LeftPane: React.FC = ({ case ContactCheckboxDisabledReason.MaximumContactsSelected: // These are no-ops. break; - case ContactCheckboxDisabledReason.NotCapable: - cantAddContactToGroup(conversationId); - break; default: throw missingCaseError(disabledReason); } diff --git a/ts/components/conversation/conversation-details/AddGroupMembersModal.tsx b/ts/components/conversation/conversation-details/AddGroupMembersModal.tsx index 3850fc5e89..c7da8390ce 100644 --- a/ts/components/conversation/conversation-details/AddGroupMembersModal.tsx +++ b/ts/components/conversation/conversation-details/AddGroupMembersModal.tsx @@ -1,4 +1,4 @@ -// Copyright 2021 Signal Messenger, LLC +// Copyright 2021-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import type { FunctionComponent } from 'react'; @@ -46,7 +46,6 @@ enum Stage { } type StateType = { - cantAddContactForModal: undefined | ConversationType; maximumGroupSizeModalState: OneTimeModalState; recommendedGroupSizeModalState: OneTimeModalState; searchTerm: string; @@ -60,7 +59,6 @@ enum ActionType { ConfirmAdds, RemoveSelectedContact, ReturnToContactChooser, - SetCantAddContactForModal, ToggleSelectedContact, UpdateSearchTerm, } @@ -71,10 +69,6 @@ type Action = | { type: ActionType.ConfirmAdds } | { type: ActionType.ReturnToContactChooser } | { type: ActionType.RemoveSelectedContact; conversationId: string } - | { - type: ActionType.SetCantAddContactForModal; - contact: undefined | ConversationType; - } | { type: ActionType.ToggleSelectedContact; conversationId: string; @@ -118,11 +112,6 @@ function reducer( action.conversationId ), }; - case ActionType.SetCantAddContactForModal: - return { - ...state, - cantAddContactForModal: action.contact, - }; case ActionType.ToggleSelectedContact: return { ...state, @@ -167,7 +156,6 @@ export const AddGroupMembersModal: FunctionComponent = ({ const [ { - cantAddContactForModal, maximumGroupSizeModalState, recommendedGroupSizeModalState, searchTerm, @@ -176,7 +164,6 @@ export const AddGroupMembersModal: FunctionComponent = ({ }, dispatch, ] = useReducer(reducer, { - cantAddContactForModal: undefined, maximumGroupSizeModalState: isGroupAlreadyFull ? OneTimeModalState.Showing : OneTimeModalState.NeverShown, @@ -198,22 +185,6 @@ export const AddGroupMembersModal: FunctionComponent = ({ selectedConversationIds ); - if (cantAddContactForModal) { - return ( - { - dispatch({ - type: ActionType.SetCantAddContactForModal, - contact: undefined, - }); - }} - /> - ); - } - if (maximumGroupSizeModalState === OneTimeModalState.Showing) { return ( = ({ conversationId, }); }; - const setCantAddContactForModal = ( - contact: undefined | Readonly - ) => { - dispatch({ - type: ActionType.SetCantAddContactForModal, - contact, - }); - }; const setSearchTerm = (term: string) => { dispatch({ type: ActionType.UpdateSearchTerm, @@ -280,7 +243,6 @@ export const AddGroupMembersModal: FunctionComponent = ({ = ({ removeSelectedContact={removeSelectedContact} searchTerm={searchTerm} selectedContacts={selectedContacts} - setCantAddContactForModal={setCantAddContactForModal} setSearchTerm={setSearchTerm} theme={theme} toggleSelectedContact={toggleSelectedContact} diff --git a/ts/components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal.tsx b/ts/components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal.tsx index 967802f161..c985939e82 100644 --- a/ts/components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal.tsx +++ b/ts/components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal.tsx @@ -8,7 +8,6 @@ import Measure from 'react-measure'; import type { LocalizerType, ThemeType } from '../../../../types/Util'; import { assert } from '../../../../util/assert'; -import { getOwn } from '../../../../util/getOwn'; import { refMerger } from '../../../../util/refMerger'; import { useRestoreFocus } from '../../../../hooks/useRestoreFocus'; import { missingCaseError } from '../../../../util/missingCaseError'; @@ -27,7 +26,6 @@ import { SearchInput } from '../../../SearchInput'; type PropsType = { candidateContacts: ReadonlyArray; confirmAdds: () => void; - contactLookup: Record; conversationIdsAlreadyInGroup: Set; getPreferredBadge: PreferredBadgeSelectorType; i18n: LocalizerType; @@ -36,9 +34,6 @@ type PropsType = { removeSelectedContact: (_: string) => void; searchTerm: string; selectedContacts: ReadonlyArray; - setCantAddContactForModal: ( - _: Readonly - ) => void; setSearchTerm: (_: string) => void; theme: ThemeType; toggleSelectedContact: (conversationId: string) => void; @@ -48,7 +43,6 @@ type PropsType = { export const ChooseGroupMembersModal: FunctionComponent = ({ candidateContacts, confirmAdds, - contactLookup, conversationIdsAlreadyInGroup, getPreferredBadge, i18n, @@ -57,7 +51,6 @@ export const ChooseGroupMembersModal: FunctionComponent = ({ removeSelectedContact, searchTerm, selectedContacts, - setCantAddContactForModal, setSearchTerm, theme, toggleSelectedContact, @@ -111,8 +104,6 @@ export const ChooseGroupMembersModal: FunctionComponent = ({ disabledReason = ContactCheckboxDisabledReason.AlreadyAdded; } else if (hasSelectedMaximumNumberOfContacts && !isSelected) { disabledReason = ContactCheckboxDisabledReason.MaximumContactsSelected; - } else if (!contact.isGroupV2Capable) { - disabledReason = ContactCheckboxDisabledReason.NotCapable; } return { @@ -212,15 +203,6 @@ export const ChooseGroupMembersModal: FunctionComponent = ({ case ContactCheckboxDisabledReason.MaximumContactsSelected: // These are no-ops. break; - case ContactCheckboxDisabledReason.NotCapable: { - const contact = getOwn(contactLookup, conversationId); - assert( - contact, - 'Contact was not in lookup; not showing modal' - ); - setCantAddContactForModal(contact); - break; - } default: throw missingCaseError(disabledReason); } diff --git a/ts/components/conversationList/ContactCheckbox.tsx b/ts/components/conversationList/ContactCheckbox.tsx index f1863a2d56..7c28203b21 100644 --- a/ts/components/conversationList/ContactCheckbox.tsx +++ b/ts/components/conversationList/ContactCheckbox.tsx @@ -1,4 +1,4 @@ -// Copyright 2021 Signal Messenger, LLC +// Copyright 2021-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import type { FunctionComponent, ReactNode } from 'react'; @@ -18,7 +18,6 @@ export enum ContactCheckboxDisabledReason { // We start the enum at 1 because the default starting value of 0 is falsy. AlreadyAdded = 1, MaximumContactsSelected, - NotCapable, } export type PropsDataType = { diff --git a/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx b/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx index abf94c48f8..ca9fa016e1 100644 --- a/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx +++ b/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx @@ -25,7 +25,6 @@ import { export type LeftPaneChooseGroupMembersPropsType = { candidateContacts: ReadonlyArray; - cantAddContactForModal: undefined | ConversationType; isShowingRecommendedGroupSizeModal: boolean; isShowingMaximumGroupSizeModal: boolean; searchTerm: string; @@ -35,10 +34,6 @@ export type LeftPaneChooseGroupMembersPropsType = { export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper { private readonly candidateContacts: ReadonlyArray; - private readonly cantAddContactForModal: - | undefined - | Readonly<{ title: string }>; - private readonly isShowingMaximumGroupSizeModal: boolean; private readonly isShowingRecommendedGroupSizeModal: boolean; @@ -51,7 +46,6 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper unknown; closeMaximumGroupSizeModal: () => unknown; closeRecommendedGroupSizeModal: () => unknown; i18n: LocalizerType; @@ -158,15 +149,6 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper ); - } else if (this.cantAddContactForModal) { - modalNode = ( - - ); } return ( @@ -254,15 +236,10 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper { clearConversationSearch: () => unknown; clearGroupCreationError: () => void; clearSearch: () => unknown; - closeCantAddContactToGroupModal: () => unknown; closeMaximumGroupSizeModal: () => unknown; closeRecommendedGroupSizeModal: () => unknown; composeDeleteAvatarFromDisk: DeleteAvatarFromDiskActionType; diff --git a/ts/groups.ts b/ts/groups.ts index 02fa38d00f..0727404fc0 100644 --- a/ts/groups.ts +++ b/ts/groups.ts @@ -638,22 +638,10 @@ export async function buildAddMembersChange( } // Refresh our local data to be sure - if ( - !contact.get('capabilities')?.gv2 || - !contact.get('profileKey') || - !contact.get('profileKeyCredential') - ) { + if (!contact.get('profileKey') || !contact.get('profileKeyCredential')) { await contact.getProfiles(); } - if (!contact.get('capabilities')?.gv2) { - assert( - false, - `buildAddMembersChange/${logId}: member is missing GV2 capability; skipping` - ); - return; - } - const profileKey = contact.get('profileKey'); const profileKeyCredential = contact.get('profileKeyCredential'); @@ -1511,22 +1499,10 @@ export async function createGroupV2({ } // Refresh our local data to be sure - if ( - !contact.get('capabilities')?.gv2 || - !contact.get('profileKey') || - !contact.get('profileKeyCredential') - ) { + if (!contact.get('profileKey') || !contact.get('profileKeyCredential')) { await contact.getProfiles(); } - if (!contact.get('capabilities')?.gv2) { - assert( - false, - `createGroupV2/${logId}: member is missing GV2 capability; skipping` - ); - return; - } - if (contact.get('profileKey') && contact.get('profileKeyCredential')) { membersV2.push({ uuid: contactUuid, @@ -1836,22 +1812,14 @@ export async function getGroupMigrationMembers( // Refresh our local data to be sure if ( - !capabilities || - !capabilities.gv2 || - !capabilities['gv1-migration'] || + !capabilities?.['gv1-migration'] || !contact.get('profileKeyCredential') ) { await contact.getProfiles(); } capabilities = contact.get('capabilities'); - if (!capabilities || !capabilities.gv2) { - log.warn( - `getGroupMigrationMembers/${logId}: membersV2 - member ${e164} is missing gv2 capability, skipping.` - ); - return null; - } - if (!capabilities || !capabilities['gv1-migration']) { + if (!capabilities?.['gv1-migration']) { log.warn( `getGroupMigrationMembers/${logId}: membersV2 - member ${e164} is missing gv1-migration capability, skipping.` ); @@ -1916,14 +1884,7 @@ export async function getGroupMigrationMembers( } const capabilities = contact.get('capabilities'); - if (!capabilities || !capabilities.gv2) { - log.warn( - `getGroupMigrationMembers/${logId}: pendingMembersV2 - member ${e164} is missing gv2 capability, skipping.` - ); - droppedGV2MemberIds.push(conversationId); - return null; - } - if (!capabilities || !capabilities['gv1-migration']) { + if (!capabilities?.['gv1-migration']) { log.warn( `getGroupMigrationMembers/${logId}: pendingMembersV2 - member ${e164} is missing gv1-migration capability, skipping.` ); diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index 9d88c6c28b..89e642a079 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -1815,9 +1815,6 @@ export class ConversationModel extends window.Backbone isBlocked: this.isBlocked(), isMe: isMe(this.attributes), isGroupV1AndDisabled: this.isGroupV1AndDisabled(), - isGroupV2Capable: isDirectConversation(this.attributes) - ? Boolean(this.get('capabilities')?.gv2) - : undefined, isPinned: this.get('isPinned'), isUntrusted: this.isUntrusted(), isVerified: this.isVerified(), diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index ba2be7a8d4..35f233634f 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -133,7 +133,6 @@ export type ConversationType = { isArchived?: boolean; isBlocked?: boolean; isGroupV1AndDisabled?: boolean; - isGroupV2Capable?: boolean; isPinned?: boolean; isUntrusted?: boolean; isVerified?: boolean; @@ -298,7 +297,6 @@ type ComposerStateType = | ({ step: ComposerStep.ChooseGroupMembers; searchTerm: string; - cantAddContactIdForModal: undefined | string; } & ComposerGroupCreationState) | ({ step: ComposerStep.SetGroupMetadata; @@ -402,12 +400,6 @@ export type CancelVerificationDataByConversationActionType = { canceledAt: number; }; }; -type CantAddContactToGroupActionType = { - type: 'CANT_ADD_CONTACT_TO_GROUP'; - payload: { - conversationId: string; - }; -}; type ClearGroupCreationErrorActionType = { type: 'CLEAR_GROUP_CREATION_ERROR' }; type ClearInvitedUuidsForNewlyCreatedGroupActionType = { type: 'CLEAR_INVITED_UUIDS_FOR_NEWLY_CREATED_GROUP'; @@ -421,9 +413,6 @@ type ClearCancelledVerificationActionType = { conversationId: string; }; }; -type CloseCantAddContactToGroupModalActionType = { - type: 'CLOSE_CANT_ADD_CONTACT_TO_GROUP_MODAL'; -}; type CloseContactSpoofingReviewActionType = { type: 'CLOSE_CONTACT_SPOOFING_REVIEW'; }; @@ -736,14 +725,12 @@ type ReplaceAvatarsActionType = { }; export type ConversationActionType = | CancelVerificationDataByConversationActionType - | CantAddContactToGroupActionType | ClearCancelledVerificationActionType | ClearVerificationDataByConversationActionType | ClearGroupCreationErrorActionType | ClearInvitedUuidsForNewlyCreatedGroupActionType | ClearSelectedMessageActionType | ClearUnreadMetricsActionType - | CloseCantAddContactToGroupModalActionType | CloseContactSpoofingReviewActionType | CloseMaximumGroupSizeModalActionType | CloseRecommendedGroupSizeModalActionType @@ -801,14 +788,12 @@ export type ConversationActionType = export const actions = { cancelConversationVerification, - cantAddContactToGroup, clearCancelledConversationVerification, clearGroupCreationError, clearInvitedUuidsForNewlyCreatedGroup, clearSelectedMessage, clearUnreadMetrics, clearUsernameSave, - closeCantAddContactToGroupModal, closeContactSpoofingReview, closeMaximumGroupSizeModal, closeRecommendedGroupSizeModal, @@ -1379,14 +1364,6 @@ function composeReplaceAvatar( }; } -function cantAddContactToGroup( - conversationId: string -): CantAddContactToGroupActionType { - return { - type: 'CANT_ADD_CONTACT_TO_GROUP', - payload: { conversationId }, - }; -} function setPreJoinConversation( data: PreJoinConversationType | undefined ): SetPreJoinConversationActionType { @@ -1722,9 +1699,6 @@ function clearUnreadMetrics( }, }; } -function closeCantAddContactToGroupModal(): CloseCantAddContactToGroupModalActionType { - return { type: 'CLOSE_CANT_ADD_CONTACT_TO_GROUP_MODAL' }; -} function closeContactSpoofingReview(): CloseContactSpoofingReviewActionType { return { type: 'CLOSE_CONTACT_SPOOFING_REVIEW' }; } @@ -2230,21 +2204,6 @@ export function reducer( }; } - if (action.type === 'CANT_ADD_CONTACT_TO_GROUP') { - const { composer } = state; - if (composer?.step !== ComposerStep.ChooseGroupMembers) { - assert(false, "Can't update modal in this composer step. Doing nothing"); - return state; - } - return { - ...state, - composer: { - ...composer, - cantAddContactIdForModal: action.payload.conversationId, - }, - }; - } - if (action.type === 'CLEAR_INVITED_UUIDS_FOR_NEWLY_CREATED_GROUP') { return omit(state, 'invitedUuidsForNewlyCreatedGroup'); } @@ -2267,24 +2226,6 @@ export function reducer( }; } - if (action.type === 'CLOSE_CANT_ADD_CONTACT_TO_GROUP_MODAL') { - const { composer } = state; - if (composer?.step !== ComposerStep.ChooseGroupMembers) { - assert( - false, - "Can't close the modal in this composer step. Doing nothing" - ); - return state; - } - return { - ...state, - composer: { - ...composer, - cantAddContactIdForModal: undefined, - }, - }; - } - if (action.type === 'CLOSE_CONTACT_SPOOFING_REVIEW') { return omit(state, 'contactSpoofingReview'); } @@ -3139,7 +3080,6 @@ export function reducer( step: ComposerStep.ChooseGroupMembers, searchTerm: '', selectedConversationIds, - cantAddContactIdForModal: undefined, recommendedGroupSizeModalState, maximumGroupSizeModalState, groupName, diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index 909d0280b2..39554c72ae 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -535,28 +535,6 @@ export const getFilteredCandidateContactsForNewGroup = createSelector( filterAndSortConversationsByTitle ); -export const getCantAddContactForModal = createSelector( - getConversationLookup, - getComposerState, - (conversationLookup, composerState): undefined | ConversationType => { - if (composerState?.step !== ComposerStep.ChooseGroupMembers) { - return undefined; - } - - const conversationId = composerState.cantAddContactIdForModal; - if (!conversationId) { - return undefined; - } - - const result = getOwn(conversationLookup, conversationId); - assert( - result, - 'getCantAddContactForModal: failed to look up conversation by ID; returning undefined' - ); - return result; - } -); - const getGroupCreationComposerState = createSelector( getComposerState, ( diff --git a/ts/state/smart/LeftPane.tsx b/ts/state/smart/LeftPane.tsx index f1d9fd66ab..b84b55ebdf 100644 --- a/ts/state/smart/LeftPane.tsx +++ b/ts/state/smart/LeftPane.tsx @@ -26,7 +26,6 @@ import { getUsernamesEnabled, } from '../selectors/items'; import { - getCantAddContactForModal, getComposeAvatarData, getComposeGroupAvatar, getComposeGroupExpireTimer, @@ -148,7 +147,6 @@ const getModeSpecificProps = ( return { mode: LeftPaneMode.ChooseGroupMembers, candidateContacts: getFilteredCandidateContactsForNewGroup(state), - cantAddContactForModal: getCantAddContactForModal(state), isShowingRecommendedGroupSizeModal: getRecommendedGroupSizeModalState(state) === OneTimeModalState.Showing, diff --git a/ts/test-both/helpers/defaultComposerStates.ts b/ts/test-both/helpers/defaultComposerStates.ts index 3d8ca364ee..d4483fd0e3 100644 --- a/ts/test-both/helpers/defaultComposerStates.ts +++ b/ts/test-both/helpers/defaultComposerStates.ts @@ -1,4 +1,4 @@ -// Copyright 2021 Signal Messenger, LLC +// Copyright 2021-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import { ComposerStep } from '../../state/ducks/conversationsEnums'; @@ -13,7 +13,6 @@ export const defaultStartDirectConversationComposerState = { export const defaultChooseGroupMembersComposerState = { step: ComposerStep.ChooseGroupMembers as const, searchTerm: '', - cantAddContactIdForModal: undefined, groupAvatar: undefined, groupName: '', groupExpireTimer: 0, diff --git a/ts/test-both/helpers/getDefaultConversation.ts b/ts/test-both/helpers/getDefaultConversation.ts index d854eb793d..f4b3f32c60 100644 --- a/ts/test-both/helpers/getDefaultConversation.ts +++ b/ts/test-both/helpers/getDefaultConversation.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2021 Signal Messenger, LLC +// Copyright 2020-2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import { v4 as generateUuid } from 'uuid'; @@ -330,7 +330,6 @@ export function getDefaultConversation( color: getRandomColor(), firstName, id: generateUuid(), - isGroupV2Capable: true, isMe: false, lastUpdated: Date.now(), markedUnread: Boolean(overrideProps.markedUnread), diff --git a/ts/test-both/state/selectors/conversations_test.ts b/ts/test-both/state/selectors/conversations_test.ts index 9046e0e69e..58efae5754 100644 --- a/ts/test-both/state/selectors/conversations_test.ts +++ b/ts/test-both/state/selectors/conversations_test.ts @@ -18,7 +18,6 @@ import { _getLeftPaneLists, getAllComposableConversations, getCandidateContactsForNewGroup, - getCantAddContactForModal, getComposableContacts, getComposableGroups, getComposeGroupAvatar, @@ -1162,53 +1161,6 @@ describe('both/state/selectors/conversations', () => { }); }); - describe('#getCantAddContactForModal', () => { - it('returns undefined if not in the "choose group members" composer step', () => { - assert.isUndefined(getCantAddContactForModal(getEmptyRootState())); - - assert.isUndefined( - getCantAddContactForModal({ - ...getEmptyRootState(), - conversations: { - ...getEmptyState(), - composer: defaultStartDirectConversationComposerState, - }, - }) - ); - }); - - it("returns undefined if there's no contact marked", () => { - assert.isUndefined( - getCantAddContactForModal({ - ...getEmptyRootState(), - conversations: { - ...getEmptyState(), - composer: defaultChooseGroupMembersComposerState, - }, - }) - ); - }); - - it('returns the marked contact', () => { - const conversation = makeConversation('abc123'); - - assert.deepEqual( - getCantAddContactForModal({ - ...getEmptyRootState(), - conversations: { - ...getEmptyState(), - conversationLookup: { abc123: conversation }, - composer: { - ...defaultChooseGroupMembersComposerState, - cantAddContactIdForModal: 'abc123', - }, - }, - }), - conversation - ); - }); - }); - describe('#getComposerConversationSearchTerm', () => { it("returns the composer's contact search term", () => { assert.strictEqual( diff --git a/ts/test-electron/state/ducks/conversations_test.ts b/ts/test-electron/state/ducks/conversations_test.ts index 04175ca0f2..897fe05049 100644 --- a/ts/test-electron/state/ducks/conversations_test.ts +++ b/ts/test-electron/state/ducks/conversations_test.ts @@ -47,10 +47,8 @@ import { import { updateRemoteConfig } from '../../../test-both/helpers/RemoteConfigStub'; const { - cantAddContactToGroup, clearGroupCreationError, clearInvitedUuidsForNewlyCreatedGroup, - closeCantAddContactToGroupModal, closeContactSpoofingReview, closeMaximumGroupSizeModal, closeRecommendedGroupSizeModal, @@ -461,22 +459,6 @@ describe('both/state/ducks/conversations', () => { }); }); - describe('CANT_ADD_CONTACT_TO_GROUP', () => { - it('marks the conversation ID as "cannot add"', () => { - const state = { - ...getEmptyState(), - composer: defaultChooseGroupMembersComposerState, - }; - const action = cantAddContactToGroup('abc123'); - const result = reducer(state, action); - - assert( - result.composer?.step === ComposerStep.ChooseGroupMembers && - result.composer.cantAddContactIdForModal === 'abc123' - ); - }); - }); - describe('CLEAR_GROUP_CREATION_ERROR', () => { it('clears the group creation error', () => { const state = { @@ -512,26 +494,6 @@ describe('both/state/ducks/conversations', () => { }); }); - describe('CLOSE_CANT_ADD_CONTACT_TO_GROUP_MODAL', () => { - it('closes the "cannot add contact" modal"', () => { - const state = { - ...getEmptyState(), - composer: { - ...defaultChooseGroupMembersComposerState, - cantAddContactIdForModal: 'abc123', - }, - }; - const action = closeCantAddContactToGroupModal(); - const result = reducer(state, action); - - assert( - result.composer?.step === ComposerStep.ChooseGroupMembers && - result.composer.cantAddContactIdForModal === undefined, - 'Expected the contact ID to be cleared' - ); - }); - }); - describe('CLOSE_CONTACT_SPOOFING_REVIEW', () => { it('closes the contact spoofing review modal if it was open', () => { const state = { diff --git a/ts/test-node/components/leftPane/LeftPaneChooseGroupMembersHelper_test.ts b/ts/test-node/components/leftPane/LeftPaneChooseGroupMembersHelper_test.ts index 31687af480..8f4a776d16 100644 --- a/ts/test-node/components/leftPane/LeftPaneChooseGroupMembersHelper_test.ts +++ b/ts/test-node/components/leftPane/LeftPaneChooseGroupMembersHelper_test.ts @@ -14,7 +14,6 @@ import { updateRemoteConfig } from '../../../test-both/helpers/RemoteConfigStub' describe('LeftPaneChooseGroupMembersHelper', () => { const defaults = { candidateContacts: [], - cantAddContactForModal: undefined, isShowingRecommendedGroupSizeModal: false, isShowingMaximumGroupSizeModal: false, searchTerm: '', @@ -163,39 +162,5 @@ describe('LeftPaneChooseGroupMembersHelper', () => { disabledReason: undefined, }); }); - - it("disables contacts that aren't GV2-capable, unless they are already selected somehow", () => { - const candidateContacts = [ - { ...getDefaultConversation(), isGroupV2Capable: false }, - { ...getDefaultConversation(), isGroupV2Capable: undefined }, - { ...getDefaultConversation(), isGroupV2Capable: false }, - ]; - - const helper = new LeftPaneChooseGroupMembersHelper({ - ...defaults, - candidateContacts, - searchTerm: 'foo bar', - selectedContacts: [candidateContacts[2]], - }); - - assert.deepEqual(helper.getRow(1), { - type: RowType.ContactCheckbox, - contact: candidateContacts[0], - isChecked: false, - disabledReason: ContactCheckboxDisabledReason.NotCapable, - }); - assert.deepEqual(helper.getRow(2), { - type: RowType.ContactCheckbox, - contact: candidateContacts[1], - isChecked: false, - disabledReason: ContactCheckboxDisabledReason.NotCapable, - }); - assert.deepEqual(helper.getRow(3), { - type: RowType.ContactCheckbox, - contact: candidateContacts[2], - isChecked: true, - disabledReason: undefined, - }); - }); }); }); diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 6cad9a03f9..369a8f0725 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -658,7 +658,6 @@ export type WebAPIConnectType = { export type CapabilitiesType = { announcementGroup: boolean; - gv2: boolean; 'gv1-migration': boolean; senderKey: boolean; changeNumber: boolean;