Update data associated to phone pointers on phone number change.
This commit is contained in:
parent
4ba9f959fe
commit
6298f9a105
@ -11,7 +11,7 @@ import { MutableKeyStore, PGPSigner, Signer } from '@app/_pgp';
|
|||||||
import { RegistryService } from '@app/_services/registry.service';
|
import { RegistryService } from '@app/_services/registry.service';
|
||||||
import { CICRegistry } from '@cicnet/cic-client';
|
import { CICRegistry } from '@cicnet/cic-client';
|
||||||
import { personValidation, updateSyncable, vcardValidation } from '@app/_helpers';
|
import { personValidation, updateSyncable, vcardValidation } from '@app/_helpers';
|
||||||
import { add0x } from '@src/assets/js/ethtx/dist/hex';
|
import { add0x, strip0x } from '@src/assets/js/ethtx/dist/hex';
|
||||||
import { KeystoreService } from '@app/_services/keystore.service';
|
import { KeystoreService } from '@app/_services/keystore.service';
|
||||||
const vCard = require('vcard-parser');
|
const vCard = require('vcard-parser');
|
||||||
|
|
||||||
@ -75,7 +75,8 @@ export class UserService {
|
|||||||
businessCategory: string,
|
businessCategory: string,
|
||||||
userLocation: string,
|
userLocation: string,
|
||||||
location: string,
|
location: string,
|
||||||
locationType: string
|
locationType: string,
|
||||||
|
oldPhoneNumber: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const accountInfo: any = {
|
const accountInfo: any = {
|
||||||
vcard: {
|
vcard: {
|
||||||
@ -142,6 +143,14 @@ export class UserService {
|
|||||||
await this.updateMeta(syncableAccount, accountKey, this.headers);
|
await this.updateMeta(syncableAccount, accountKey, this.headers);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
if (phoneNumber !== oldPhoneNumber) {
|
||||||
|
const oldPhoneKey: string = await Phone.toKey(oldPhoneNumber);
|
||||||
|
const newPhoneKey: string = await Phone.toKey(phoneNumber);
|
||||||
|
const newPhoneData: Syncable = new Syncable(newPhoneKey, strip0x(address));
|
||||||
|
await this.updateMeta(newPhoneData, newPhoneKey, this.headers);
|
||||||
|
const oldPhoneData: Syncable = new Syncable(oldPhoneKey, '');
|
||||||
|
await this.updateMeta(oldPhoneData, oldPhoneKey, this.headers);
|
||||||
|
}
|
||||||
return accountKey;
|
return accountKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,8 @@ export class AccountDetailsComponent implements OnInit, AfterViewInit {
|
|||||||
this.accountInfoFormStub.businessCategory.value,
|
this.accountInfoFormStub.businessCategory.value,
|
||||||
this.accountInfoFormStub.userLocation.value,
|
this.accountInfoFormStub.userLocation.value,
|
||||||
this.accountInfoFormStub.location.value,
|
this.accountInfoFormStub.location.value,
|
||||||
this.accountInfoFormStub.locationType.value
|
this.accountInfoFormStub.locationType.value,
|
||||||
|
this.account.vcard?.tel[0].value
|
||||||
);
|
);
|
||||||
this.submitted = false;
|
this.submitted = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user