Skip to content

Commit b588aac

Browse files
committed
fix(copy): Hide not copyable addressbooks in copy select
Signed-off-by: Johannes Merkel <mail@johannesgge.de>
1 parent 9e839b6 commit b588aac

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/components/ContactDetails.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
<NcSelect ref="pickAddressbook"
208208
v-model="pickedAddressbook"
209209
:allow-empty="false"
210-
:options="addressbooksOptions"
210+
:options="copyableAddressbooksOptions"
211211
:placeholder="t('contacts', 'Select address book')"
212212
track-by="id"
213213
label="name" />
@@ -245,6 +245,8 @@
245245
empty property because this is a required prop on regular property-select. But since
246246
we are hijacking this... (this is supposed to be used with a ICAL.property, but to avoid code
247247
duplication, we created a fake propModel and property with our own options here) -->
248+
<!-- We need to pass all addressbooksOptions not only writable ones. Otherwise the the name
249+
can't be displayed for readOnly addressbooks -->
248250
<PropertySelect :prop-model="addressbookModel"
249251
:options="addressbooksOptions"
250252
:value.sync="addressbook"
@@ -531,6 +533,24 @@ export default {
531533
})
532534
},
533535
536+
/**
537+
* Store getters filtered and mapped to usable object
538+
* This is the list of addressbooks that are available to copy to
539+
*
540+
* @return {{id: string, name: string}[]}
541+
*/
542+
copyableAddressbooksOptions() {
543+
return this.addressbooksOptions
544+
.filter(option => !option.readOnly)
545+
.filter(option => option.id !== this.contact.addressbook.id)
546+
.map(addressbook => {
547+
return {
548+
id: addressbook.id,
549+
name: addressbook.name,
550+
}
551+
})
552+
},
553+
534554
// store getter
535555
addressbooks() {
536556
return this.$store.getters.getAddressbooks

0 commit comments

Comments
 (0)