diff options
author | Sylvain <git@sylvain.dev> | 2022-10-02 17:42:47 +0200 |
---|---|---|
committer | Sylvain METAYER <s.metayer@groupeonepoint.com> | 2022-10-11 11:36:46 +0200 |
commit | e9730d6b425cf30a6345685af9f987b166d4a16c (patch) | |
tree | aac58695c3c4085525d9d482678d0033799f1149 /src/components/ContactDetails.vue | |
parent | 4575f443fc49d597e5988e07851f4a0cbfab08cd (diff) |
feat(2464): exclude contact from birthday calendar
Signed-off-by: Sylvain <git@sylvain.dev>
Co-authored-by: Thomas Citharel <github@tcit.fr>
Co-authored-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'src/components/ContactDetails.vue')
-rw-r--r-- | src/components/ContactDetails.vue | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/components/ContactDetails.vue b/src/components/ContactDetails.vue index 97aaf610..e333ea43 100644 --- a/src/components/ContactDetails.vue +++ b/src/components/ContactDetails.vue @@ -139,6 +139,14 @@ </template> {{ t('contacts', 'Generate QR Code') }} </ActionButton> + <ActionButton v-if="enableToggleBirthdayExclusion" + :close-after-click="true" + @click="toggleBirthdayExclusionForContact"> + <template #icon> + <CakeIcon :size="20" /> + </template> + {{ excludeFromBirthdayLabel }} + </ActionButton> <ActionButton v-if="!isReadOnly" @click="deleteContact"> <template #icon> <IconDelete :size="20" /> @@ -267,6 +275,7 @@ import IconLoading from '@nextcloud/vue/dist/Components/NcLoadingIcon' import IconDownload from 'vue-material-design-icons/Download' import IconDelete from 'vue-material-design-icons/Delete' import IconQr from 'vue-material-design-icons/Qrcode' +import CakeIcon from 'vue-material-design-icons/Cake' import IconCopy from 'vue-material-design-icons/ContentCopy' import rfcProps from '../models/rfcProps' @@ -299,6 +308,7 @@ export default { IconDownload, IconDelete, IconQr, + CakeIcon, IconCopy, IconLoading, Modal, @@ -338,6 +348,7 @@ export default { pickedAddressbook: null, contactDetailsSelector: '.contact-details', + excludeFromBirthdayKey: 'x-nc-exclude-from-birthday-calendar', } }, @@ -502,6 +513,16 @@ export default { contact() { return this.$store.getters.getContact(this.contactKey) }, + + excludeFromBirthdayLabel() { + return this.localContact.vCard.hasProperty(this.excludeFromBirthdayKey) + ? t('contacts', 'Add contact to Birthday Calendar') + : t('contacts', 'Exclude contact from Birthday Calendar') + }, + + enableToggleBirthdayExclusion() { + return parseInt(OC.config.version.split('.')[0]) >= 26 + }, }, watch: { @@ -576,6 +597,16 @@ export default { } }, + async toggleBirthdayExclusionForContact() { + if (!this.localContact.vCard.hasProperty(this.excludeFromBirthdayKey)) { + this.localContact.vCard.addPropertyWithValue(this.excludeFromBirthdayKey, true) + } else { + this.localContact.vCard.removeProperty(this.excludeFromBirthdayKey) + } + + await this.updateContact() + }, + /** * Select the text in the input if it is still set to 'new Contact' */ |