Skip to content

Commit

Permalink
Merge pull request #1035 from nextcloud/fix/empty/values
Browse files Browse the repository at this point in the history
Remove some properties if empty
  • Loading branch information
skjnldsv authored Apr 2, 2019
2 parents 08fab90 + 1466de5 commit 0ce330c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/ContactsList/ContactsListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
14 changes: 14 additions & 0 deletions src/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down

0 comments on commit 0ce330c

Please sign in to comment.