diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-03-30 13:43:30 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2019-03-30 13:43:30 +0100 |
commit | 4fbeb292a57ade71a7097e68518aca4533008767 (patch) | |
tree | d00a3f374d242b262c5e5869ecc6b017e861543f /src | |
parent | dc9246d4f4809ef002d304ff01875f7cd3fdaf0e (diff) |
Fix display of empty property type
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/ContactDetails/ContactDetailsProperty.vue | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/components/ContactDetails/ContactDetailsProperty.vue b/src/components/ContactDetails/ContactDetailsProperty.vue index 7ed39cfa..8d65eec8 100644 --- a/src/components/ContactDetails/ContactDetailsProperty.vue +++ b/src/components/ContactDetails/ContactDetailsProperty.vue @@ -223,13 +223,14 @@ export default { // Compare array and score them by how many matches they have to the selected type // sorting directly is cleaner but slower // https://jsperf.com/array-map-and-intersection-perf - let matchingTypes = this.propModel.options.map(type => { - return { - type, - // "WORK,HOME" => ['WORK', 'HOME'] - score: type.id.split(',').filter(value => selectedType.indexOf(value) !== -1).length - } - }) + let matchingTypes = this.propModel.options + .map(type => { + return { + type, + // "WORK,HOME" => ['WORK', 'HOME'] + score: type.id.split(',').filter(value => selectedType.indexOf(value) !== -1).length + } + }) // Sort by score, filtering out the null score and selecting the first match let matchingType = matchingTypes @@ -242,10 +243,14 @@ export default { } if (this.type) { // vcard 3.0 save pref alongside TYPE - let selectedType = this.type.filter(type => type !== 'pref').join(',') - return { - id: selectedType, - name: selectedType + let selectedType = this.type + .filter(type => type !== 'pref') + .join(',') + if (selectedType.trim() !== '') { + return { + id: selectedType, + name: selectedType + } } } return null |