summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-04-02 13:28:53 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-04-02 13:28:53 +0200
commit1466de563cfb93d5c5db43d59f0e36aee9e3a42f (patch)
tree903592ff78285566add56a00f658c53689fff376 /src
parent08fab90457f499f07ee7a632eca048763b7d8c63 (diff)
Remove some properties if empty
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/components/ContactsList/ContactsListItem.vue4
-rw-r--r--src/models/contact.js14
2 files changed, 16 insertions, 2 deletions
diff --git a/src/components/ContactsList/ContactsListItem.vue b/src/components/ContactsList/ContactsListItem.vue
index 64a0b62e..98043703 100644
--- a/src/components/ContactsList/ContactsListItem.vue
+++ b/src/components/ContactsList/ContactsListItem.vue
@@ -41,8 +41,8 @@
<div class="app-content-list-item-line-one">
{{ contact.displayName }}
</div>
- <div class="icon-history" tabindex="0"
- v-tooltip.auto="t('contacts', 'Deleting the contact in {countdown} seconds', { countdown })"
+ <div v-tooltip.auto="t('contacts', 'Deleting the contact in {countdown} seconds', { countdown })" class="icon-history"
+ tabindex="0"
@click.prevent.stop="cancelDeletion" @keypress.enter.prevent.stop="cancelDeletion" />
</div>
</transition>
diff --git a/src/models/contact.js b/src/models/contact.js
index 14ea06ff..c4eebecc 100644
--- a/src/models/contact.js
+++ b/src/models/contact.js
@@ -259,6 +259,12 @@ export default class Contact {
* @memberof Contact
*/
set groups(groups) {
+ // delete the title if empty
+ if (isEmpty(groups)) {
+ this.vCard.removeProperty('categories')
+ return true
+ }
+
if (Array.isArray(groups)) {
let property = this.vCard.getFirstProperty('categories')
if (!property) {
@@ -308,6 +314,10 @@ export default class Contact {
* @memberof Contact
*/
set org(org) {
+ // delete the org if empty
+ if (isEmpty(org)) {
+ return this.vCard.removeProperty('org')
+ }
return this.vCard.updatePropertyWithValue('org', org)
}
@@ -328,6 +338,10 @@ export default class Contact {
* @memberof Contact
*/
set title(title) {
+ // delete the title if empty
+ if (isEmpty(title)) {
+ return this.vCard.removeProperty('title')
+ }
return this.vCard.updatePropertyWithValue('title', title)
}