Fix UI bug with self-add by username in groups
This commit is contained in:
parent
41e89554fe
commit
ca2b3bacce
8 changed files with 21 additions and 1 deletions
|
@ -35,6 +35,7 @@ export type LeftPaneChooseGroupMembersPropsType = {
|
|||
isShowingRecommendedGroupSizeModal: boolean;
|
||||
isShowingMaximumGroupSizeModal: boolean;
|
||||
isUsernamesEnabled: boolean;
|
||||
ourUsername: string | undefined;
|
||||
searchTerm: string;
|
||||
regionCode: string | undefined;
|
||||
selectedContacts: Array<ConversationType>;
|
||||
|
@ -74,6 +75,7 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
|
|||
isUsernamesEnabled,
|
||||
groupSizeRecommendedLimit,
|
||||
groupSizeHardLimit,
|
||||
ourUsername,
|
||||
searchTerm,
|
||||
regionCode,
|
||||
selectedContacts,
|
||||
|
@ -94,6 +96,7 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
|
|||
const username = getUsernameFromSearch(searchTerm);
|
||||
const isUsernameVisible =
|
||||
username !== undefined &&
|
||||
username !== ourUsername &&
|
||||
this.candidateContacts.every(contact => contact.username !== username);
|
||||
|
||||
if (isUsernamesEnabled) {
|
||||
|
@ -109,7 +112,11 @@ export class LeftPaneChooseGroupMembersHelper extends LeftPaneHelper<LeftPaneCho
|
|||
}
|
||||
|
||||
const phoneNumber = parseAndFormatPhoneNumber(searchTerm, regionCode);
|
||||
if (!isUsernameVisible && phoneNumber) {
|
||||
if (
|
||||
!isUsernameVisible &&
|
||||
(ourUsername === undefined || username !== ourUsername) &&
|
||||
phoneNumber
|
||||
) {
|
||||
this.isPhoneNumberChecked =
|
||||
phoneNumber.isValid &&
|
||||
selectedContacts.some(contact => contact.e164 === phoneNumber.e164);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue