Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine bday and deathdate #4377

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions src/components/ContactDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<!-- org, title -->
<template #subtitle>
<template v-if="isReadOnly">
<span v-html="formattedSubtitle" />

Check warning on line 51 in src/components/ContactDetails.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'v-html' directive can lead to XSS attack
</template>
<template v-else>
<input id="contact-title"
Expand Down Expand Up @@ -88,7 +88,7 @@
<IconAccount :size="20" />
</template>
</ActionButton>
<ActionLink v-for="emailAddress in emailAddressList"

Check warning on line 91 in src/components/ContactDetails.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Variable 'emailAddress' is already declared in the upper scope
:key="emailAddress"
class="quick-action"
:href="'mailto:' + emailAddress">
Expand Down Expand Up @@ -252,6 +252,20 @@
<!-- properties iteration -->
<!-- using contact.key in the key and index as key to avoid conflicts between similar data and exact key -->

<!-- Special handling for lifeEvents -->
<div v-if="name === 'lifeEvents'" class="life-events-group">
<ContactDetailsProperty v-for="(property, index) in properties"
:key="`${index}-${contact.key}-${property.name}`"
:is-first-property="index===0"
:is-last-property="index === properties.length - 1"

Check warning on line 260 in src/components/ContactDetails.vue

View check run for this annotation

Codecov / codecov/patch

src/components/ContactDetails.vue#L258-L260

Added lines #L258 - L260 were not covered by tests
:property="property"
:contact="contact"
:local-contact="localContact"
:contacts="contacts"
:bus="bus"
:is-read-only="isReadOnly" />
</div>

<div v-for="(properties, name) in groupedProperties"
:key="name">
<ContactDetailsProperty v-for="(property, index) in properties"
Expand Down Expand Up @@ -356,18 +370,18 @@
import { getSVG } from '@shortcm/qr-image/lib/svg'
import mitt from 'mitt'
import {
NcActions as Actions,
isMobile,

Check warning on line 373 in src/components/ContactDetails.vue

View check run for this annotation

Codecov / codecov/patch

src/components/ContactDetails.vue#L373

Added line #L373 was not covered by tests
NcActionButton as ActionButton,
NcActionLink as ActionLink,
NcActions as Actions,
NcAppContentDetails as AppContentDetails,
NcButton,
NcEmptyContent as EmptyContent,
NcModal as Modal,
NcSelect,
NcEmptyContent,
NcLoadingIcon as IconLoading,
NcButton,
NcModal as Modal,
NcRelatedResourcesPanel,
isMobile,
NcEmptyContent,
NcSelect,
} from '@nextcloud/vue'
import IconContact from 'vue-material-design-icons/AccountMultiple.vue'
import IconDownload from 'vue-material-design-icons/Download.vue'
Expand Down Expand Up @@ -575,6 +589,15 @@
return list
}

// Group bday and deathdate together under 'lifeEvents'
if (property.name === 'bday' || property.name === 'deathdate' || property.name === 'anniversary') {

Check warning on line 593 in src/components/ContactDetails.vue

View check run for this annotation

Codecov / codecov/patch

src/components/ContactDetails.vue#L592-L593

Added lines #L592 - L593 were not covered by tests
if (!list.lifeEvents) {
list.lifeEvents = []
}
list.lifeEvents.push(property)
return list

Check warning on line 598 in src/components/ContactDetails.vue

View check run for this annotation

Codecov / codecov/patch

src/components/ContactDetails.vue#L596-L598

Added lines #L596 - L598 were not covered by tests
}

// Init if needed
if (!list[property.name]) {
list[property.name] = []
Expand Down Expand Up @@ -954,7 +977,7 @@
/**
* Update this.localContact and set this.fixed
*
* @param {Contact} contact the contact to clone

Check warning on line 980 in src/components/ContactDetails.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'Contact' is undefined
*/
async updateLocalContact(contact) {
// create empty contact and copy inner data
Expand Down Expand Up @@ -1005,7 +1028,7 @@
/**
* Should display the property
*
* @param {Property} property the property to check

Check warning on line 1031 in src/components/ContactDetails.vue

View workflow job for this annotation

GitHub Actions / NPM lint

The type 'Property' is undefined
* @return {boolean}
*/
canDisplay(property) {
Expand Down
11 changes: 10 additions & 1 deletion src/components/Properties/PropertyTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>

<h3 class="property__value">
{{ readableName }}
{{ displayName }}
</h3>

<div class="property__actions">
Expand Down Expand Up @@ -71,6 +71,15 @@
required: false,
},
},
computed: {
displayName() {
if (this.property.name === 'bday' || this.property.name === 'deathdate' || this.property.name === 'anniversary') {
return this.t('contacts', 'Personal dates')
}

return this.readableName

Check warning on line 80 in src/components/Properties/PropertyTitle.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Properties/PropertyTitle.vue#L79-L80

Added lines #L79 - L80 were not covered by tests
},
},

Check warning on line 82 in src/components/Properties/PropertyTitle.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Properties/PropertyTitle.vue#L82

Added line #L82 was not covered by tests
methods: {
/**
* Add prop of type id
Expand Down
Loading