Assume everyone is GV2-capable

This commit is contained in:
Evan Hahn 2022-03-04 13:48:44 -06:00 committed by GitHub
parent 0a52318be6
commit effe5aae6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 16 additions and 405 deletions

View file

@ -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,

View file

@ -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,
(

View file

@ -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,