More permissive username search

This commit is contained in:
Fedor Indutny
2024-02-14 10:18:49 -08:00
committed by GitHub
parent 89525d3e16
commit 4a41e87173
17 changed files with 121 additions and 31 deletions
@@ -18,7 +18,6 @@ import {
} from '../AddGroupMemberErrorDialog';
import { Button } from '../Button';
import type { LocalizerType } from '../../types/Util';
import { getUsernameFromSearch } from '../../types/Username';
import type { ParsedE164Type } from '../../util/libphonenumberInstance';
import { parseAndFormatPhoneNumber } from '../../util/libphonenumberInstance';
import type { UUIDFetchStateType } from '../../util/uuidFetchState';
@@ -38,6 +37,7 @@ export type LeftPaneChooseGroupMembersPropsType = {
ourUsername: string | undefined;
searchTerm: string;
regionCode: string | undefined;
username: string | undefined;
selectedContacts: Array<ConversationType>;
};
@@ -80,6 +80,7 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
regionCode,
selectedContacts,
uuidFetchState,
username,
}: Readonly<LeftPaneChooseGroupMembersPropsType>) {
super();
@@ -93,7 +94,6 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
isShowingRecommendedGroupSizeModal;
this.searchTerm = searchTerm;
const username = getUsernameFromSearch(searchTerm);
const isUsernameVisible =
username !== undefined &&
username !== ourUsername &&
@@ -12,7 +12,6 @@ import { SearchInput } from '../SearchInput';
import type { LocalizerType } from '../../types/Util';
import type { ParsedE164Type } from '../../util/libphonenumberInstance';
import { parseAndFormatPhoneNumber } from '../../util/libphonenumberInstance';
import { getUsernameFromSearch } from '../../types/Username';
import type { UUIDFetchStateType } from '../../util/uuidFetchState';
import {
isFetchingByUsername,
@@ -27,6 +26,7 @@ export type LeftPaneComposePropsType = {
regionCode: string | undefined;
searchTerm: string;
uuidFetchState: UUIDFetchStateType;
username: string | undefined;
};
enum TopButtons {
@@ -57,6 +57,7 @@ export class LeftPaneComposeHelper extends LeftPaneHelper<LeftPaneComposePropsTy
regionCode,
searchTerm,
uuidFetchState,
username,
}: Readonly<LeftPaneComposePropsType>) {
super();
@@ -65,8 +66,6 @@ export class LeftPaneComposeHelper extends LeftPaneHelper<LeftPaneComposePropsTy
this.searchTerm = searchTerm;
this.uuidFetchState = uuidFetchState;
const username = getUsernameFromSearch(this.searchTerm);
this.username = username;
this.isUsernameVisible =
Boolean(username) &&
@@ -9,7 +9,6 @@ import type { Row } from '../ConversationList';
import { RowType } from '../ConversationList';
import { SearchInput } from '../SearchInput';
import type { LocalizerType } from '../../types/Util';
import { getUsernameFromSearch } from '../../types/Username';
import type { ShowConversationType } from '../../state/ducks/conversations';
import type { UUIDFetchStateType } from '../../util/uuidFetchState';
import { isFetchingByUsername } from '../../util/uuidFetchState';
@@ -21,6 +20,7 @@ import { Button } from '../Button';
export type LeftPaneFindByUsernamePropsType = {
searchTerm: string;
uuidFetchState: UUIDFetchStateType;
username: string | undefined;
};
type DoLookupActionsType = Readonly<{
@@ -39,13 +39,14 @@ export class LeftPaneFindByUsernameHelper extends LeftPaneHelper<LeftPaneFindByU
constructor({
searchTerm,
uuidFetchState,
username,
}: Readonly<LeftPaneFindByUsernamePropsType>) {
super();
this.searchTerm = searchTerm;
this.uuidFetchState = uuidFetchState;
this.username = getUsernameFromSearch(this.searchTerm);
this.username = username;
}
override getHeaderContents({