Enable usernames

This commit is contained in:
Fedor Indutny 2024-02-07 16:34:31 -08:00 committed by GitHub
parent 38da3d3152
commit 43de83f0de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 196 additions and 438 deletions

View file

@ -34,7 +34,6 @@ export type LeftPaneChooseGroupMembersPropsType = {
groupSizeHardLimit: number;
isShowingRecommendedGroupSizeModal: boolean;
isShowingMaximumGroupSizeModal: boolean;
isUsernamesEnabled: boolean;
ourE164: string | undefined;
ourUsername: string | undefined;
searchTerm: string;
@ -73,7 +72,6 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
candidateContacts,
isShowingMaximumGroupSizeModal,
isShowingRecommendedGroupSizeModal,
isUsernamesEnabled,
groupSizeRecommendedLimit,
groupSizeHardLimit,
ourE164,
@ -101,18 +99,14 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
username !== ourUsername &&
this.candidateContacts.every(contact => contact.username !== username);
if (isUsernamesEnabled) {
if (isUsernameVisible) {
this.username = username;
}
this.isUsernameChecked = selectedContacts.some(
contact => contact.username === this.username
);
} else {
this.isUsernameChecked = false;
if (isUsernameVisible) {
this.username = username;
}
this.isUsernameChecked = selectedContacts.some(
contact => contact.username === this.username
);
const phoneNumber = parseAndFormatPhoneNumber(searchTerm, regionCode);
if (
!isUsernameVisible &&

View file

@ -28,7 +28,6 @@ export type LeftPaneComposePropsType = {
regionCode: string | undefined;
searchTerm: string;
uuidFetchState: UUIDFetchStateType;
isUsernamesEnabled: boolean;
};
enum TopButton {
@ -58,7 +57,6 @@ export class LeftPaneComposeHelper extends LeftPaneHelper<LeftPaneComposePropsTy
composeGroups,
regionCode,
searchTerm,
isUsernamesEnabled,
uuidFetchState,
}: Readonly<LeftPaneComposePropsType>) {
super();
@ -70,15 +68,10 @@ export class LeftPaneComposeHelper extends LeftPaneHelper<LeftPaneComposePropsTy
const username = getUsernameFromSearch(this.searchTerm);
if (isUsernamesEnabled) {
this.username = username;
this.isUsernameVisible =
isUsernamesEnabled &&
Boolean(username) &&
this.composeContacts.every(contact => contact.username !== username);
} else {
this.isUsernameVisible = false;
}
this.username = username;
this.isUsernameVisible =
Boolean(username) &&
this.composeContacts.every(contact => contact.username !== username);
const phoneNumber = parseAndFormatPhoneNumber(searchTerm, regionCode);
if (!username && phoneNumber) {