diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-09-08 16:04:52 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-09-08 21:04:28 +0200 |
commit | 5bac2a13014c57328abd60bc519f56e41343beda (patch) | |
tree | 1e2fd112306ff0e2846ab84725f2ae8e6623781c /src | |
parent | b33920d2c61f77efb76dbafa38895e4c09c8c232 (diff) |
Fix import addressbook display name
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/ProcessingScreen.vue | 1 | ||||
-rw-r--r-- | src/components/Settings/SettingsImportContacts.vue | 11 | ||||
-rw-r--r-- | src/services/parseVcf.js | 7 | ||||
-rw-r--r-- | src/store/addressbooks.js | 1 |
4 files changed, 15 insertions, 5 deletions
diff --git a/src/components/ProcessingScreen.vue b/src/components/ProcessingScreen.vue index 99acc09b..d4964660 100644 --- a/src/components/ProcessingScreen.vue +++ b/src/components/ProcessingScreen.vue @@ -62,6 +62,7 @@ export default { &__desc { display: inline-flex; align-items: center; + width: 100%; margin-top: 22px; color: var(--color-text-maxcontrast); diff --git a/src/components/Settings/SettingsImportContacts.vue b/src/components/Settings/SettingsImportContacts.vue index 73cc4cd6..18c49fbe 100644 --- a/src/components/Settings/SettingsImportContacts.vue +++ b/src/components/Settings/SettingsImportContacts.vue @@ -196,12 +196,14 @@ export default { const file = event.target.files[0] const reader = new FileReader() - const selectedAddressbook = this.selectedAddressbook + + const addressbook = this.selectedAddressbook + this.$store.dispatch('setAddressbook', addressbook.displayName) const self = this reader.onload = function(e) { self.isOpened = false - self.$store.dispatch('importContactsIntoAddressbook', { vcf: reader.result, addressbook: selectedAddressbook }) + self.$store.dispatch('importContactsIntoAddressbook', { vcf: reader.result, addressbook }) // reset input event.target.value = '' @@ -223,11 +225,12 @@ export default { cancelToken: source.token, }) + const addressbook = this.selectedAddressbook this.$store.dispatch('changeStage', 'parsing') - this.$store.dispatch('setAddressbook', this.selectedAddressbook.displayName) + this.$store.dispatch('setAddressbook', addressbook.displayName) if (file.data) { - await this.$store.dispatch('importContactsIntoAddressbook', { vcf: file.data, addressbook: this.selectedAddressbook }) + await this.$store.dispatch('importContactsIntoAddressbook', { vcf: file.data, addressbook }) } } catch (error) { console.error('Something wrong happened while processing local file', error) diff --git a/src/services/parseVcf.js b/src/services/parseVcf.js index 2b5bef53..5184c809 100644 --- a/src/services/parseVcf.js +++ b/src/services/parseVcf.js @@ -28,7 +28,12 @@ export default function parseVcf(data = '', addressbook) { const vCards = data.match(regexp) if (!vCards) { - console.error('Error during the parsing of the following vcf file: ', data) + console.error('Error during the parsing of the following vcf file', data) + return [] + } + + if (!addressbook) { + console.error('Invalid addressbook', addressbook) return [] } diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js index 1a4a7c49..6dfd5971 100644 --- a/src/store/addressbooks.js +++ b/src/store/addressbooks.js @@ -407,6 +407,7 @@ const actions = { // create the array of requests to send contacts.map(async contact => { + console.info(contact) // Get vcard string try { |