Use libsignal-client for username validation

This commit is contained in:
Fedor Indutny 2023-05-24 02:07:59 +02:00 committed by GitHub
parent 3ff390e1c4
commit c0663ed57c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 68 deletions

View file

@ -68,20 +68,20 @@ export class LeftPaneComposeHelper extends LeftPaneHelper<LeftPaneComposePropsTy
this.searchTerm = searchTerm;
this.uuidFetchState = uuidFetchState;
const username = getUsernameFromSearch(this.searchTerm);
if (isUsernamesEnabled) {
this.username = getUsernameFromSearch(this.searchTerm);
this.username = username;
this.isUsernameVisible =
isUsernamesEnabled &&
Boolean(this.username) &&
this.composeContacts.every(
contact => contact.username !== this.username
);
Boolean(username) &&
this.composeContacts.every(contact => contact.username !== username);
} else {
this.isUsernameVisible = false;
}
const phoneNumber = parseAndFormatPhoneNumber(searchTerm, regionCode);
if (!this.username && phoneNumber) {
if (!username && phoneNumber) {
this.phoneNumber = phoneNumber;
this.isPhoneNumberVisible = this.composeContacts.every(
contact => contact.e164 !== phoneNumber.e164