diff --git a/src/views/ContactImportView.vue b/src/views/ContactImportView.vue index 9946e28..198c7e1 100644 --- a/src/views/ContactImportView.vue +++ b/src/views/ContactImportView.vue @@ -124,7 +124,10 @@ export default class ContactImportView extends Vue { contactsSelected: Array = []; // whether each contact in contactsImporting is selected contactDifferences: Record< string, - Record + Record< + string, + { new: string | boolean | undefined; old: string | boolean | undefined } + > > = {}; // for existing contacts, it shows the difference between imported and existing contacts for each key importing = false; makeVisible = true; @@ -170,12 +173,19 @@ export default class ContactImportView extends Vue { if (existingContact) { this.contactsExisting[contactIn.did] = existingContact; - const differences: Record = {}; + const differences: Record< + string, + { + new: string | boolean | undefined; + old: string | boolean | undefined; + } + > = {}; Object.keys(contactIn).forEach((key) => { - if (contactIn[key] !== existingContact[key]) { + // eslint-disable-next-line prettier/prettier + if (contactIn[key as keyof Contact] !== existingContact[key as keyof Contact]) { differences[key] = { - old: existingContact[key], - new: contactIn[key], + old: existingContact[key as keyof Contact], + new: contactIn[key as keyof Contact], }; } }); @@ -211,22 +221,24 @@ export default class ContactImportView extends Vue { if (this.makeVisible) { const failedVisibileToContacts = []; for (let i = 0; i < this.contactsImporting.length; i++) { - const contact = this.contactsImporting[i]; - if (contact) { - const visResult = await setVisibilityUtil( - this.activeDid, - this.apiServer, - this.axios, - db, - contact, - true, - ); - if (!visResult.success) { - failedVisibileToContacts.push(contact); + if (this.contactsSelected[i]) { + const contact = this.contactsImporting[i]; + if (contact) { + const visResult = await setVisibilityUtil( + this.activeDid, + this.apiServer, + this.axios, + db, + contact, + true, + ); + if (!visResult.success) { + failedVisibileToContacts.push(contact); + } } } } - if (failedVisibileToContacts.length) { + if (failedVisibileToContacts.length > 0) { this.$notify( { group: "alert",