Merge pull request #2844 from nextcloud/fix/noid/fix-copy-to-full-name

Fix copy to full name and omit year actions
This commit is contained in:
Christoph Wurst 2022-07-15 20:38:12 +02:00 committed by GitHub
commit 84b1bfe866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 9 deletions

View File

@ -21,7 +21,7 @@
-->
<template>
<ActionButton icon="icon-up" @click="copyNtoFN">
<ActionButton icon="icon-up" @click="copyNToFN">
{{ t('contacts', 'Copy to full name') }}
</ActionButton>
</template>
@ -37,13 +37,12 @@ export default {
mixins: [ActionsMixin],
methods: {
copyNToFN() {
console.info(this.component)
if (this.component.contact.vCard.hasProperty('n')) {
if (this.component.localContact.vCard.hasProperty('n')) {
// Stevenson;John;Philip,Paul;Dr.;Jr.,M.D.,A.C.P.
// -> John Stevenson
const n = this.component.contact.vCard.getFirstPropertyValue('n')
this.component.contact.fullName = n.slice(0, 2).reverse().join(' ')
this.component.updateContact()
const n = this.component.localContact.vCard.getFirstPropertyValue('n')
this.component.localContact.fullName = n.slice(0, 2).reverse().join(' ')
this.component.$emit('update')
}
},
},

View File

@ -28,9 +28,10 @@
</template>
{{ t('contacts', 'Delete') }}
</ActionButton>
<Actions :is="action"
v-for="(action, index) in actions"
:key="index" />
<component v-for="action in actions"
:is="action"
:key="action.name"
:component="propertyComponent" />
</Actions>
</template>
@ -53,6 +54,10 @@ export default {
type: Array,
default: () => [],
},
propertyComponent: {
type: Object,
required: true,
},
},
methods: {

View File

@ -73,6 +73,7 @@
<PropertyActions
v-if="!isReadOnly"
:actions="actions"
:property-component="this"
@delete="deleteProperty" />
</div>
</div>